comp.lang.python - 26 new messages in 8 topics - digest
comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en
comp.lang.python@googlegroups.com
Today's topics:
* basic maze problem with turtle - 10 messages, 8 authors
http://groups.google.com/group/comp.lang.python/t/0d217b05b26660df?hl=en
* Would you l like to take over lockfile? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/d0f4b410cec4a998?hl=en
* converting letters to numbers - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/8ab97564e4b6b15b?hl=en
* Searching for a list of strings in a file with Python - 3 messages, 3
authors
http://groups.google.com/group/comp.lang.python/t/313c86e60f09f9ed?hl=en
* Query on Python Compiled source--Urgent - 6 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/c0ecca810321eb45?hl=en
* Python was designed (was Re: Multi-threading in Python vs Java) - 1 messages,
1 author
http://groups.google.com/group/comp.lang.python/t/8bc8406dfdc4a3e1?hl=en
* Trying to force turtle back to beginning of maze after collides with wall -
1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/382b108c66d776a9?hl=en
* python33.lib missing for build_ext in venv environment - 2 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/60c7001d117b4f1e?hl=en
==============================================================================
TOPIC: basic maze problem with turtle
http://groups.google.com/group/comp.lang.python/t/0d217b05b26660df?hl=en
==============================================================================
== 1 of 10 ==
Date: Sun, Oct 13 2013 4:54 pm
From: Steven D'Aprano
On Sun, 13 Oct 2013 22:03:04 +0000, Denis McMahon wrote:
> On Sun, 13 Oct 2013 14:53:36 -0700, baujacob wrote:
>
>> Is there anyway I can force the user back to the starting point when
>> the turtle hits the wall?
[skip useful advise to a beginner]
> Except perhaps [skip completely uncalled for baiting of somebody not
> even remotely collected to this thread.]
Was that really necessary?
--
Steven
== 2 of 10 ==
Date: Sun, Oct 13 2013 6:53 pm
From: Dennis Lee Bieber
On Sun, 13 Oct 2013 15:18:27 -0700 (PDT), baujacob@gmail.com declaimed the
following:
>
>Sorry about that, I realized I forgot to include the code.
>So basically I have one turtle that draws the maze at the beginning and then another turtle(userTurtle) that completes the maze. When the userTurtle hits any point on the wall, I want to force userTurtle back to the start of the maze.
Still seems rather harsh to me... After all, one of the common
suggestions for solving a maze is to "always follow [right/left] hand" (put
said hand on said wall -- walk keeping that hand in contact with the wall
-- if you hit a dead end, the 180 turn-around will pick up the other wall
and carry our around the branch that lead to that dead-end). But you are
postulating "hit a dead end, through out all progress, start over"
Is "userTurtle" being guided by a real user? If so, resetting to the
start on each dead-end is a major penalty, the user should have the option
of back-tracking and picking another turn.
If "userTurtle" is a separate algorithm it should still have a
back-track ability. The difference is whether the algorithm uses a wall
following scheme, or a random direction at any intersection. Note that,
without memorizing choices for each intersection, the random direction mode
can result in repeating a failed path.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
== 3 of 10 ==
Date: Mon, Oct 14 2013 1:16 am
From: Antoon Pardon
Op 14-10-13 00:03, Denis McMahon schreef:
> Except perhaps Nikos. Nikos can probably write you extremely elegant one
> line python solutions to any coding problem you describe to him. His
> solutions might suffer the very minor flaw of not working, but they're
> guaranteed to be Nikos certified aesthetically pure, and hence far
> superior to any solution more mundane coders might produce.
I don't think including this was a smart move. It risks turning this
totally unrelated thread into a Nikos-like thread. I don't think
baujacob did anything that deserves that his question will be used
as an opportunity to have a jab at Nikos which may turn this thread
into something totally unhelpful for baujacob himself.
--
Antoon Pardon
== 4 of 10 ==
Date: Mon, Oct 14 2013 4:29 am
From: Alister
On Sun, 13 Oct 2013 14:53:36 -0700, baujacob wrote:
> Hi everyone, I'm trying to create a simple maze program. When the user
> finishes the maze, I want to print in big letters "You Win!" and when
> the user hits a wall, I want the user to go back to the beginning of the
> maze. The problem is "collision detection" which is an advanced topic
> and I'm only in a beginning programming class. Is there anyway I can
> force the user back to the starting point when the turtle hits the wall?
> Thank you in advance.
returning the user to the start is a simple case of resetting the user's
coordinates.
unless you are referring to a true turtle in a physical maze in which
case your requirement is probably not a good idea (What happens if you
bump a wall on your way back)
more details of the exact scenario may enable some more pointers in the
right direction.
--
Stop searching forever. Happiness is just next to you.
== 5 of 10 ==
Date: Mon, Oct 14 2013 5:54 am
From: Denis McMahon
On Sun, 13 Oct 2013 23:54:34 +0000, Steven D'Aprano wrote:
(and Gary Herron wrote similar)
> Was that really necessary?
Am I still pissed at being told my solution was crap because it had too
many lines?
--
Denis McMahon, denismfmcmahon@gmail.com
== 6 of 10 ==
Date: Mon, Oct 14 2013 6:02 am
From: "Sam Fourman Jr."
On Sun, Oct 13, 2013 at 11:44 PM, Gary Herron <
gary.herron@islandtraining.com> wrote:
> On 10/13/2013 03:03 PM, Denis McMahon wrote:
>
>> Except perhaps Nikos. Nikos can probably write you extremely elegant one
>> line python solutions to any coding problem you describe to him. His
>> solutions might suffer the very minor flaw of not working, but they're
>> guaranteed to be Nikos certified aesthetically pure, and hence far
>> superior to any solution more mundane coders might produce.
>>
>
> That was uncalled for. There is already too much Nikos-bashing and
> Nikos-basher-bashing (and so on) in this newsgroup without dredging up even
> more in this completely unrelated request.
>
> Gary Herron
>
>
> --
> https://mail.python.org/**mailman/listinfo/python-list<https://mail.python.org/mailman/listinfo/python-list>
>
Who the hell is Nikos? I hear reference to this guy ALL the time, is he a
troll or a python god?
this simply isn't clear.. I have only been on this list a few months.
--
Sam Fourman Jr.
== 7 of 10 ==
Date: Mon, Oct 14 2013 6:13 am
From: Neil Cerutti
On 2013-10-14, Sam Fourman Jr. <sfourman@gmail.com> wrote:
> Who the hell is Nikos? I hear reference to this guy ALL the
> time, is he a troll or a python god? this simply isn't clear..
> I have only been on this list a few months.
Check the archives for the last couple of months, and make your
own judgment.
https://mail.python.org/pipermail/python-list/
--
Neil Cerutti
== 8 of 10 ==
Date: Mon, Oct 14 2013 6:17 am
From: Alister
On Mon, 14 Oct 2013 13:13:15 +0000, Neil Cerutti wrote:
> On 2013-10-14, Sam Fourman Jr. <sfourman@gmail.com> wrote:
>> Who the hell is Nikos? I hear reference to this guy ALL the time, is he
>> a troll or a python god? this simply isn't clear..
>> I have only been on this list a few months.
>
> Check the archives for the last couple of months, and make your own
> judgment.
>
> https://mail.python.org/pipermail/python-list/
He is an excellent roll model for newbies.
(Do the opposite of Nicos at all times & you wont go far wrong)
--
The worst part of valor is indiscretion.
== 9 of 10 ==
Date: Mon, Oct 14 2013 6:16 am
From: Chris Angelico
On Tue, Oct 15, 2013 at 12:02 AM, Sam Fourman Jr. <sfourman@gmail.com> wrote:
> Who the hell is Nikos? I hear reference to this guy ALL the time, is he a
> troll or a python god?
> this simply isn't clear.. I have only been on this list a few months.
He's a troll, sometimes goes by the name "Ferrous Cranus", and he
really isn't worth polluting this thread about. Search python-list
archives for superhost.gr (his web site - be aware that he and it are
Greek, so some of his error messages and such are non-ASCII) and have
a read. Unfortunately he manages to drive a number of people to
frustration, which results in bad blood and spiralling unpleasantness,
which sometimes spills over into other threads, like this.
What we really should do is use multiple processes of conversation,
instead of threads. That way, if one goes rogue, it can't affect
memory used by other conversations...
ChrisA
== 10 of 10 ==
Date: Mon, Oct 14 2013 6:22 am
From: Antoon Pardon
Op 14-10-13 15:02, Sam Fourman Jr. schreef:
>
> Who the hell is Nikos? I hear reference to this guy ALL the time, is he
> a troll or a python god?
> this simply isn't clear.. I have only been on this list a few months.
He is the lists help vampire. He comes to the list when his programs
break and insists that we help him out. Advise to read up on a
particular subject is generally ignored as are links that explain what
is going on. When a correction is offered, he often enough rejects it
because it is somehow too many lines or such reasons. When he finnaly
accept a correction, that often enough reveals a new bug and the
cycle restarts.
--
Antoon Pardon
==============================================================================
TOPIC: Would you l like to take over lockfile?
http://groups.google.com/group/comp.lang.python/t/d0f4b410cec4a998?hl=en
==============================================================================
== 1 of 1 ==
Date: Sun, Oct 13 2013 7:24 pm
From: Ben Finney
Skip Montanaro <skip@pobox.com> writes:
> I don't have the time or inclination to continue supporting lockfile (
> https://pypi.python.org/pypi/lockfile/). If you'd like to take it over, let
> me know.
I have some experience working with the above project, and am willing to
assist. Please join us on the developer discussion forum for the code,
<URL:http://lists.alioth.debian.org/mailman/listinfo/python-lockfile-devel>.
In my opinion, we *really* need someone to become the domain expert for
the code on Windows.
--
\ "Life does not cease to be funny when people die any more than |
`\ it ceases to be serious when people laugh." —George Bernard Shaw |
_o__) |
Ben Finney
==============================================================================
TOPIC: converting letters to numbers
http://groups.google.com/group/comp.lang.python/t/8ab97564e4b6b15b?hl=en
==============================================================================
== 1 of 2 ==
Date: Sun, Oct 13 2013 8:13 pm
From: Tim Roberts
kjakupak@gmail.com wrote:
>
>Transfer it to an uppercase letter if it's a letter, if it's not then an error.
>This isn't right, I know, just testing around
>
>def add(c1, c2):
> ans = ''
> for i in c1 + c2:
> ans += chr((((ord(i)-65))%26) + 65)
> return ans
It's close. I think you're overthinking it. Take it step by step. Decode,
process, encode. That means convert the inputs to integers, add the
integers, convert the result back.
def add(c1, c2):
% Decode
c1 = ord(c1) - 65
c2 = ord(c2) - 65
% Process
i1 = (c1 + c2) % 26
% Encode
return chr(i1+65)
Or, as a one-liner:
A = ord('A')
def add(c1, c2):
return chr((ord(c1)-A + ord(c2)-A) % 26 + A)
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
== 2 of 2 ==
Date: Sun, Oct 13 2013 10:02 pm
From: Steven D'Aprano
On Sun, 13 Oct 2013 20:13:32 -0700, Tim Roberts wrote:
> def add(c1, c2):
> % Decode
> c1 = ord(c1) - 65
> c2 = ord(c2) - 65
> % Process
> i1 = (c1 + c2) % 26
> % Encode
> return chr(i1+65)
Python uses # for comments, not %, as I'm sure you know. What language
were you thinking off when you wrote the above?
--
Steven
==============================================================================
TOPIC: Searching for a list of strings in a file with Python
http://groups.google.com/group/comp.lang.python/t/313c86e60f09f9ed?hl=en
==============================================================================
== 1 of 3 ==
Date: Sun, Oct 13 2013 10:34 pm
From: Starriol
Hi guys,
I'm trying to search for several strings, which I have in a .txt file line by line, on another file.
So the idea is, take input.txt and search for each line in that file in another file, let's call it rules.txt.
So far, I've been able to do this, to search for individual strings:
[code]import re
shakes = open("output.csv", "r")
for line in shakes:
if re.match("STRING", line):
print line,[/code]
How can I change this to input the strings to be searched from another file?
So far I haven't been able to.
Thanks for the ideas.
== 2 of 3 ==
Date: Sun, Oct 13 2013 11:33 pm
From: Peter Otten <__peter__@web.de>
Starriol wrote:
> Hi guys,
>
> I'm trying to search for several strings, which I have in a .txt file line
> by line, on another file. So the idea is, take input.txt and search for
> each line in that file in another file, let's call it rules.txt.
>
> So far, I've been able to do this, to search for individual strings:
>
> [code]import re
>
> shakes = open("output.csv", "r")
>
> for line in shakes:
> if re.match("STRING", line):
> print line,[/code]
>
> How can I change this to input the strings to be searched from another
> file?
Assuming every line in input.txt contains a regular expression and you don't
care which one matches:
shakes = open("output.csv")
# you will iterate over the regex multiple times,
# so put them in a list
rattles = [line.strip() for line in open("input.txt")]
for line in shakes:
for expr in rattles:
if re.match(expr, line):
print line,
break # out of the for-rattles loop
# at the first matching regex
== 3 of 3 ==
Date: Mon, Oct 14 2013 6:06 am
From: Dave Angel
On 14/10/2013 01:34, Starriol wrote:
> Hi guys,
>
> I'm trying to search for several strings, which I have in a .txt file line by line, on another file.
> So the idea is, take input.txt and search for each line in that file in another file, let's call it rules.txt.
>
> So far, I've been able to do this, to search for individual strings:
>
> [code]import re
>
> shakes = open("output.csv", "r")
>
> for line in shakes:
> if re.match("STRING", line):
> print line,[/code]
>
> How can I change this to input the strings to be searched from another file?
>
> So far I haven't been able to.
>
> Thanks for the ideas.
Take your existing code, and make the bulk of it into a function
definition. The function should take the 'string' as a parameter.
Once you've got that debugged, you can write code that reads your
pattern file, and for each line of it, calls the function you just
wrote.
You can certainly do it the way Peter describes, but if you learn to
factor each problem into separate functions (or classes, or generator,
or decorator, or ...) then your code will be easier to test, easier to
understand, and easier to reuse.
--
DaveA
==============================================================================
TOPIC: Query on Python Compiled source--Urgent
http://groups.google.com/group/comp.lang.python/t/c0ecca810321eb45?hl=en
==============================================================================
== 1 of 6 ==
Date: Sun, Oct 13 2013 10:41 pm
From: chandan kumar
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.
== 2 of 6 ==
Date: Mon, Oct 14 2013 12:40 am
From: Tim Golden
On 14/10/2013 06:41, chandan kumar wrote:
> 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.
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
== 3 of 6 ==
Date: Mon, Oct 14 2013 2:03 am
From: chandan kumar
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
On Monday, 14 October 2013 1:10 PM, Tim Golden <mail@timgolden.me.uk> wrote:
On 14/10/2013 06:41, chandan kumar wrote:
> 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.
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
--
https://mail.python.org/mailman/listinfo/python-list
== 4 of 6 ==
Date: Mon, Oct 14 2013 2:34 am
From: chandan kumar
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
On Monday, 14 October 2013 1:10 PM, Tim
Golden <mail@timgolden.me.uk> wrote:
On 14/10/2013 06:41,
chandan kumar wrote:
> 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.
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
--
https://mail.python.org/mailman/listinfo/python-list
-----Inline Attachment Follows-----
--
https://mail.python.org/mailman/listinfo/python-list
== 5 of 6 ==
Date: Mon, Oct 14 2013 3:10 am
From: Tim Golden
[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
== 6 of 6 ==
Date: Mon, Oct 14 2013 4:37 am
From: Alister
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"
==============================================================================
TOPIC: Python was designed (was Re: Multi-threading in Python vs Java)
http://groups.google.com/group/comp.lang.python/t/8bc8406dfdc4a3e1?hl=en
==============================================================================
== 1 of 1 ==
Date: Mon, Oct 14 2013 3:39 am
From: rusi
On Sunday, October 13, 2013 6:34:56 PM UTC+5:30, Roy Smith wrote:
> To be fair to Larry, there were different design drivers working there.
One more thing to be said for perl:
I remember when some colleague first told me about perl (I guess early 90s) I was incredulous that the *same* language could run on DOS and on Unix unchanged.
Yeah in principle we all talked about portability however in practice, we found that the only program that would run on all systems was the asymptotic null C program:
main() {;}
So a full scale language whose programs ran unchanged on all systems was BIG back then.
That we take it for granted today indicates the shoulders of the giants we are standing on.
==============================================================================
TOPIC: Trying to force turtle back to beginning of maze after collides with
wall
http://groups.google.com/group/comp.lang.python/t/382b108c66d776a9?hl=en
==============================================================================
== 1 of 1 ==
Date: Mon, Oct 14 2013 6:25 am
From: Denis McMahon
On Sun, 13 Oct 2013 15:26:03 -0700, baujacob wrote:
> Hi everyone, I'm trying to create a simple maze program. When the user
> finishes the maze, I want to print in big letters "You Win!" and when
> the user hits a wall, I want the user to go back to the beginning of the
> maze. The problem is "collision detection" which is an advanced topic
> and I'm only in a beginning programming class. Is there anyway I can
> force the user back to the starting point when the turtle hits the wall?
OK
My first observation is that "maze" could be an array of "rooms" each of
which starts life with 4 exits.
Generating the maze would involve turning exits into walls.
You could create a set maze, or you could randomly generate a maze at the
start of each "game".
Once you have created a maze, define your start and end points.
If you want to apply your logic, then if the "solver" turtle enters a
"room" with only one exit, it is in a dead end.
The "solver" turtle would probably need to store which paths led to dead
ends to ensure it did not follow them again. This extends back to any
exit that only leads to dead ends.
Let's consider a simple maze, 2x2 so 4 rooms. Room 0 is the top left (nw)
room, and rooms are numbered across, down. Each room number has 4 exit
directions, nesw. 'x' is an external exit, a number is an internal room,
None is no exit (ie a wall).
maze = { 0: { 'n': 'x', 'e': 1, 's': None, w: None },
1: { 'n': None, 'e': None, 's': 3, w: 0 },
2: { 'n': None, 'e': 3, 's': 'x', w: None },
3: { 'n': 1, 'e': None, 's': None, w: 2 } }
Room 0 (nw) has an exit (or entrance) to the north and an internal path
to the east (rm 1).
Room 1 (ne) has internal paths to the west (rm 0) and south (rm 3).
Room 2 (sw) has an entrance (or exit) to the south and an internal path
to the east (rm 3).
Room 3 (se) has internal links to the north (rm 1) and west (rm 2).
The data structure shown (a dictionary of dictionaries) is just one way
of holding the maze data, and perhaps not the most elegant. The maze
could be stored as a dictionary of tuples thus:
maze = { 0: ( 'x', 1, None, None ),
1: ( None, None, 3, 0 ),
2: ( None, 3, 'x', None ),
3: ( 1, None, None, 2 ) }
Drawing such a maze graphically would require allocating co-ordinates in
some drawing space to the vertices of each room, and drawing lines along
the edges that represent walls.
Navigating such a maze graphically would require allocating co-ordinates
in the same drawing space to the centres of the rooms, and moving between
adjacent room centres provided the exit was "open".
--
Denis McMahon, denismfmcmahon@gmail.com
==============================================================================
TOPIC: python33.lib missing for build_ext in venv environment
http://groups.google.com/group/comp.lang.python/t/60c7001d117b4f1e?hl=en
==============================================================================
== 1 of 2 ==
Date: Mon, Oct 14 2013 8:17 am
From: Robin Becker
I'm trying to port reportlab extensions to Python 3.3. On windows I get a
missing library error when trying to build/install the trial reportlab in a
virtual environment eg
> C:\code\hg-repos\reportlab>\python33\python -m venv tpy33
> C:\code\hg-repos\reportlab>tpy33\Scripts\activate
> (tpy33) C:\code\hg-repos\reportlab>rm -r build
>
> (tpy33) C:\code\hg-repos\reportlab>python setup.py build_ext
> ################################################
> #Attempting install of _rl_accel, sgmlop & pyHnj
..........
> creating build\temp.win32-3.3\Release\code\hg-repos\reportlab\src\rl_addons\rl_accel
> C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\python33\include -
> IC:\python33\include /TcC:\code\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.c /Fobuild\temp.win32-3.3\Release\co
> de\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.obj
> _rl_accel.c
> creating build\lib.win32-3.3
> creating build\lib.win32-3.3\reportlab
> creating build\lib.win32-3.3\reportlab\lib
> C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\code\hg-repos\rep
> ortlab\tpy33\libs /LIBPATH:C:\python33 /LIBPATH:C:\code\hg-repos\reportlab\tpy33\PCbuild /EXPORT:PyInit__rl_accel build\
> temp.win32-3.3\Release\code\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.obj /OUT:build\lib.win32-3.3\reportlab\l
> ib\_rl_accel.pyd /IMPLIB:build\temp.win32-3.3\Release\code\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.lib /MANI
> FESTFILE:build\temp.win32-3.3\Release\code\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.pyd.manifest
> LINK : fatal error LNK1104: cannot open file 'python33.lib'
> error: command '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\link.exe"' failed with exit status 1104
>
> (tpy33) C:\code\hg-repos\reportlab>
this doesn't happen if I run the installed Python-3.3 directly eg
> (tpy33) C:\code\hg-repos\reportlab>tpy33\Scripts\deactivate.bat
> C:\code\hg-repos\reportlab>c:\python33\python setup.py build_ext
> ################################################
............
> Standard T1 font curves already downloaded
> running build_ext
> building 'reportlab.lib._rl_accel' extension
> C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python33\include -
> Ic:\python33\include /TcC:\code\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.c /Fobuild\temp.win32-3.3\Release\co
> de\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.obj
> _rl_accel.c
> C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\python33\libs /LI
> BPATH:c:\python33\PCbuild /EXPORT:PyInit__rl_accel build\temp.win32-3.3\Release\code\hg-repos\reportlab\src\rl_addons\rl
> _accel\_rl_accel.obj /OUT:build\lib.win32-3.3\reportlab\lib\_rl_accel.pyd /IMPLIB:build\temp.win32-3.3\Release\code\hg-r
> epos\reportlab\src\rl_addons\rl_accel\_rl_accel.lib /MANIFESTFILE:build\temp.win32-3.3\Release\code\hg-repos\reportlab\s
> rc\rl_addons\rl_accel\_rl_accel.pyd.manifest
> Creating library build\temp.win32-3.3\Release\code\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.lib and object
> build\temp.win32-3.3\Release\code\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.exp
is this a bug or some misconfiguration; should I be using virtualenv?
--
Robin Becker
== 2 of 2 ==
Date: Mon, Oct 14 2013 8:28 am
From: Robin Becker
On 14/10/2013 16:17, Robin Becker wrote:
> I'm trying to port reportlab extensions to Python 3.3. On windows I get a
> missing library error when trying to build/install the trial reportlab in a
> virtual environment eg
>
>> C:\code\hg-repos\reportlab>\python33\python -m venv tpy33
.........ns\rl_accel\_rl_accel.lib
>> /MANI
>> FESTFILE:build\temp.win32-3.3\Release\code\hg-repos\reportlab\src\rl_addons\rl_accel\_rl_accel.pyd.manifest
>>
>> LINK : fatal error LNK1104: cannot open file 'python33.lib'
>> error: command '"C:\Program Files\Microsoft Visual Studio
>> 10.0\VC\BIN\link.exe"' failed with exit status 1104
>>
>> (tpy33) C:\code\hg-repos\reportlab>
.........
>
> is this a bug or some misconfiguration; should I be using virtualenv?
seems that venv doesn't copy the standard Libs directory into the virtual
environment; if I do that by hand then I get a proper working virtual
environment. Also seems fairly half baked to change the name bin to Scripts, but
perhaps there's some windows centric reason for that even though the Scripts dir
ends up with a lot of dlls & pyds in it. I suppose that ps1 files are in fact
scripts.
--
Robin Becker
==============================================================================
You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.
To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en
To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com
To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en
To report abuse, send email explaining the problem to abuse@googlegroups.com
==============================================================================
Google Groups: http://groups.google.com/?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home