Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Query on Python Compiled source--Urgent

40 views
Skip to first unread message

chandan kumar

unread,
Oct 14, 2013, 1:41:35 AM10/14/13
to Python
Hi,

I'm working on a python project for protocol testing.I need to provide only python compiled source to our customer.

Here are the steps followed to take python compiled from actual source.
1.There are 5 different test suites under the project
2..Run all 5  test suite with python sources.
3.After completion of test suite ,just take .pyc files and copied in to seperate folder.
4.Re run test suite for any issues with the .pyc code.I started seeing one issue when it logs the test results in to excel file.
 This issue occurs sometimes.50% of chances are there to see this issue

Below is the error
Traceback (most recent call last):
  File "D:\users\ScriptTestCode\scriptsCompiledCode\ExecuteScripts.py", line 32, in <module>
    TestManager.execute_scripts(TEST_BUILD)
  File "D:\users\ScriptTestCode\scriptsCompiledCode\TestManager.py", line 764, in execute_scripts
  File "D:\users\ScriptTestCode\scriptsCompiledCode\TestManager.py", line 772, in _execute_all
  File "D:\users\ScriptTestCode\scriptsCompiledCode\TestManager.py", line 924, in _testsuite_950_band
  File "D:\users\ScriptTestCode\scriptsCompiledCode\TestManager.py", line 377, in exec_test_suite
  File "D:\users\ScriptTestCode\scripts\ResultReporter.py", line 321, in save_test_results
    _my_doc.save(StackTestData.TEST_REPORT_PATH)
  File "C:\Python27\lib\site-packages\pyExcelerator\Workbook.py", line 610, in save
    doc.save(filename, self.get_biff_data())
  File "C:\Python27\lib\site-packages\pyExcelerator\CompoundDoc.py", line 554, in save
    f = file(filename, 'wb')
IOError: [Errno 22] invalid mode ('wb') or filename: '.\\TestResults\\TestReport.xls'

Now my question is of there any issue with logging to excel it should happen for the first test suite itself,but it occurs in either 2,3,4 or 5 test suite. Some it runs without any issues.

Please let me know do i need to follow any sequence when copying  compiled source code and  whats exactly going wrong here.

Best Regards,
Chandan.

Tim Golden

unread,
Oct 14, 2013, 3:40:11 AM10/14/13
to pytho...@python.org
Well, the fact that it works/fails 50% of the time points to a race
condition. You don't say how the test suites / tests are running, but if
anything's running in parallel, one test's cleanup could be pulling the
file out from under another test's writing results. Without knowing more
about your test runner, this is really guess-work.

Logging to Excel isn't part of the builtin logging module so you've
presumably added that functionality yourself. But PyExcelerator is
ultimately just opening a file and writing to it so for this purpose it
appears to be equivalent to, say, logging a bunch of stuff into a list
and then writing that into a file.

TJG

chandan kumar

unread,
Oct 14, 2013, 5:03:18 AM10/14/13
to Tim Golden, pytho...@python.org
Hi,
Yes ,its not actual logging module.Using pyexcelerator we are storing just test results to excel file.
Each test suite has some 25-100 test cases.We are using unit test from python ,after completion of each test case the test result will be stored in excel file.Below is the sample result that is stored in excel file.

S.No   TestCaseID   TestDescription    TestResult 
1         Test_case_1 SetTransmitPower  Pass
2         Test_case_2 Set  Frequency        fail

Nothing is running parallel.

Best Regards,
Chandan


chandan kumar

unread,
Oct 14, 2013, 5:34:44 AM10/14/13
to pytho...@python.org



Hi,

Yes ,its not actual logging module.Using pyexcelerator we are storing just test results to excel file.Each test suite has some 25-100 test cases.We are using unit test from python ,after completion of each test case the test result will be stored in excel file.Below is the sample result that is stored in excel file.

S.No   TestCaseID   TestDescription     TestResult 
1         Test_case_1 SetTransmitPower  Pass
2 Test_case_2     Set  Frequency Fail
-----Inline Attachment Follows-----

--
https://mail.python.org/mailman/listinfo/python-list

Tim Golden

unread,
Oct 14, 2013, 6:10:45 AM10/14/13
to pytho...@python.org
[Please post your answer below the previous reply, not above]

[... snip most of original traceback ...]

> File "C:\Python27\lib\site-packages\pyExcelerator\CompoundDoc.py",
> line 554, in save
> f = file(filename, 'wb')
> IOError: [Errno 22] invalid mode ('wb') or filename:
> '.\\TestResults\\TestReport.xls'
>
> Now my question is of there any issue with logging to excel it should
> happen for the first test suite itself,but it occurs in either 2,3,4 or
> 5 test suite. Some it runs without any issues.

On 14/10/2013 10:34, chandan kumar wrote:
> Yes ,its not actual logging module.Using pyexcelerator we are storing just test results to excel file.Each test suite has some 25-100 test cases.We are using unit test from python ,after completion of each test case the test result will be stored in excel file.Below is the sample result that is stored in excel file.
>
> S.No TestCaseID TestDescription TestResult
> 1 Test_case_1 SetTransmitPower Pass
> 2 Test_case_2 Set Frequency Fail
>
>
> Nothing is running parallel.

Sorry -- I didn't look closely enough at the error message. "invalid
mode or filename" wouldn't be the result of a file getting deleted out
from under a write.

Error 22 is returned from the MS runtime as EINVAL. It's not clear from
the traceback why it would consider that path invalid, but you're going
to have to do some legwork to narrow it down, I'm afraid.

The most likely prospects is that you're not running in the directory
you think you're in. Try putting a "print os.getcwd()" somewhere in the
mix to see where you actually are.

However, that still wouldn't quite explain why it occurs only sometimes
but, as I said, we'd have to know more about your test-runner to be able
to help.

TJG

Alister

unread,
Oct 14, 2013, 7:37:03 AM10/14/13
to
On Mon, 14 Oct 2013 13:41:35 +0800, chandan kumar wrote:
>
> Now my question is of there any issue with logging to excel it should
> happen for the first test suite itself,but it occurs in either 2,3,4 or
> 5 test suite. Some it runs without any issues.

Logging to excel is probably a wrong thing to do (it is not a good idea
to tie yourself into a 3rd party format that can be changed any time)

you would be better to log to a csv file which can then be opened by
excell OR ANY OTHER spreadsheet application.

it is also far easier to use the CSV module than attempting to write a
native XLS file


--
Mal: "I've seen you without your clothes on before. Never thought I'd see
you naked."
--Episode #11, "Trash"
0 new messages