Re: Fedora: Dual Python Versions Installed System Not Picking Up Newer Version

2009-03-25 Thread *nixtechno
On Mar 25, 9:22 pm, Doug Morse wrote: > On Wed, 25 Mar 2009 19:56:13 -0700 (PDT), *nixtechno > wrote: > > > > >  I have a fedora box and just installed python 2.6.1 along with 2.5.2, > >  so here's my issue, if I removed the "systems" garbage RPM it would > >  uninstall all the other crap along w

How to get the version of a file on WinOS?

2009-03-25 Thread Hill
As you know , we can see the file version from by "right click menu and click the detail tab". Now i am wondering how to get this version number using python? Thanks very much! BR -- http://mail.python.org/mailman/listinfo/python-list

Re: how to optimize zipimport

2009-03-25 Thread John Machin
On Mar 26, 2:06 pm, Coonay wrote: > see,the zipimort takes nearly 0.5 second > > D 03-25 07:53PM 21.374 > Loading __main__ > I 03-25 07:53PM 21.455 > zipimporter('/base/data/home/apps/coonay/1.332322118600950324/ > django.zip', '') ?? zipimport.Zipimporter() has one arg, not two. > W 03-25 07:53

Re: Async serial communication/threads sharing data

2009-03-25 Thread John Nagle
Jean-Paul Calderone wrote: On Tue, 24 Mar 2009 22:20:49 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood wrote: Jean-Paul Calderone wrote: [snip] After bringing in all the heavy machinery of Twisted, you're still polling at 10Hz. T

Re: What way is the best to check an empty list?

2009-03-25 Thread Steven D'Aprano
On Wed, 25 Mar 2009 21:26:10 +, Martin P. Hellwig wrote: > Raymond Hettinger wrote: >> On Mar 25, 7:38 am, srinivasan srinivas >> wrote: >>> For ex: to check list 'A' is empty or not.. if A == []: >>> if A.count == 0: >>> if len(A) == 0: >>> if not A: ... > Personally I would go for the len

Re: Fedora: Dual Python Versions Installed System Not Picking Up Newer Version

2009-03-25 Thread Doug Morse
On Wed, 25 Mar 2009 19:56:13 -0700 (PDT), *nixtechno wrote: > I have a fedora box and just installed python 2.6.1 along with 2.5.2, > so here's my issue, if I removed the "systems" garbage RPM it would > uninstall all the other crap along with it, so I went ahead and > trunked in and ./configu

Re: file open fails.

2009-03-25 Thread John Machin
On Mar 26, 3:06 pm, alex23 wrote: > On Mar 26, 8:05 am, Scott David Daniels wrote: > > > Well, yes in a way, but lots of places in windows you can get a copy > > of a full file spec into the cut buffer, so you cut/paste rather than > > type.  If you do that, you get the backslashes (and you bette

Re: file open fails.

2009-03-25 Thread alex23
On Mar 26, 8:05 am, Scott David Daniels wrote: > Well, yes in a way, but lots of places in windows you can get a copy > of a full file spec into the cut buffer, so you cut/paste rather than > type.  If you do that, you get the backslashes (and you better be > prepared for that by using r'' to past

Re: Iterating over readlines() and map()

2009-03-25 Thread alex23
On Mar 26, 10:27 am, "W. Martin Borgert" wrote: > Is this also true for this code? > > for line in map(myfunction, myfile.readlines()): >     dosomethingwith(line) > > Or would use of map() mean, that the complete "myfile" is read into > the RAM? As Christian explained, you're really after just '

Re: Does Python have certificate?

2009-03-25 Thread Tim Roberts
Steve Holden wrote: >Johannes Bauer wrote: >> Sebastian Bassi schrieb: >> >>> No, there is no certification for Python. Maybe in the future... >> >> I'll hand out the "Johannes Bauer Python Certificate of Total >> Awesomeness" for anyone who can write a hello world in python and hands >> me $25

Re: What way is the best to check an empty list?

2009-03-25 Thread Steve Holden
Stef Mientki wrote: > andrew cooke wrote: >> Andre Engels wrote: >> >>> On Wed, Mar 25, 2009 at 4:21 PM, andrew cooke wrote: >>> i will go against the grain slightly and say that "len" is probably the best compromise in most situations (although i admit i don't know what

Re: Style question - defining immutable class data members

2009-03-25 Thread Steve Holden
John Posner wrote: > On Mon Mar 16 03:42:42, I said: > >> RTFM, in section "Augmented assignment statements" of python301.chm: >> >> --- >> For targets which are attribute references, the initial value is retrieved > >> with a getattr() and the result is assigned with a setattr(). Notice that > t

Re: how to optimize zipimport

2009-03-25 Thread Coonay
see,the zipimort takes nearly 0.5 second D 03-25 07:53PM 21.374 Loading __main__ I 03-25 07:53PM 21.455 zipimporter('/base/data/home/apps/coonay/1.332322118600950324/ django.zip', '') W 03-25 07:53PM 22.046 appengine_django module On Mar 26, 10:41 am, Coonay wrote: > in my mudule ,i impor

Fedora: Dual Python Versions Installed System Not Picking Up Newer Version

2009-03-25 Thread *nixtechno
I have a fedora box and just installed python 2.6.1 along with 2.5.2, so here's my issue, if I removed the "systems" garbage RPM it would uninstall all the other crap along with it, so I went ahead and trunked in and ./configure, build && build install and built python 2.6.1 along with this. Howeve

Re: Style question - defining immutable class data members

2009-03-25 Thread John Posner
On Mon Mar 16 03:42:42, I said: > RTFM, in section "Augmented assignment statements" of python301.chm: > > --- > For targets which are attribute references, the initial value is retrieved > with a getattr() and the result is assigned with a setattr(). Notice that the > two methods do not necess

Re: What way is the best to check an empty list?

2009-03-25 Thread Josh Dukes
I believe "if not A:" is the most pythonic, but depending on what you're doing a list might not be the right thing to use at all. A little while ago I got some help from this malining list in dealing with a situation where lists really were not efficient (finding prime numbers...for fun). In my cas

Re: Debugging in Py

2009-03-25 Thread *nixtechno
Big thanks tkc, and I was wondering what your thoughts are on logging module: http://docs.python.org/library/logging.html "Instead of using many print statements for debugging, use logger.debug: Unlike the print statements, which you will have to delete or comment out later, the logger.debug state

Iterating over readlines() and map()

2009-03-25 Thread W. Martin Borgert
Hi, if I understand correctly, this code would not read the complete file into the memory: for line in myfile.readlines(): dosomethingwith(line) Is this also true for this code? for line in map(myfunction, myfile.readlines()): dosomethingwith(line) Or would use of map() mean, that the

What way is the best to check an empty list?

2009-03-25 Thread srinivasan srinivas
For ex: to check list 'A' is empty or not.. if A == []: if A.count == 0: if len(A) == 0: if not A: Connect with friends all over the world. Get Yahoo! India Messenger at http://in.messenger.yahoo.com/?wm=n/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Unit testing frameworks

2009-03-25 Thread Fabio Zadrozny
> sorry for not reporting a bug - i assumed you'd know (and the workarounds > described above meant i wasn't stalled). > > i also have eclipse 3.4.2 with pydev 1.4.4.2636 on a separate machine (ie > new versions), and i can try there if you want (it will take a while to > get the source there, but

Re: Iterating over readlines() and map()

2009-03-25 Thread W. Martin Borgert
On 2009-03-26 01:41, Christian Heimes wrote: > No, you are wrong. file.readlines() reads the entire file into memory > and returns a list of strings. If you want to iterate over the lines of > a text file you can simply write: > > for line in myfile: > dosomethingwith(line) > > It won't work fo

Re: Problem Python 2.6.1 vs 2.6 & pyWin32

2009-03-25 Thread John Machin
On 26/03/2009 9:05 AM, Mark Hammond wrote: On 25/03/2009 11:41 PM, John Machin wrote: This all sounds good. I presume that "this version of distutils" means the 2.6.2/3.1 version. Yep. In the meantime, until 2.6.2 final is released, is my suggestion of using Python 2.5 to build installers

Re: Iterating over readlines() and map()

2009-03-25 Thread Christian Heimes
W. Martin Borgert schrieb: > (Resend, because of funny error message: >> Your mail to 'Python-list' with the subject >> Iterating over readlines() and map() >> Is being held until the list moderator can review it for approval. > Whatever this means.) > > Hi, > > if I understand correctly, thi

Re: Iterating over readlines() and map()

2009-03-25 Thread W. Martin Borgert
(Resend, because of funny error message: > Your mail to 'Python-list' with the subject > Iterating over readlines() and map() > Is being held until the list moderator can review it for approval. Whatever this means.) Hi, if I understand correctly, this code would not read the complete file in

Re: Problem while copying a file from a remote filer

2009-03-25 Thread Aahz
In article , Chris Rebert wrote: >On Sun, Mar 15, 2009 at 10:24 PM, venutaurus...@gmail.com > wrote: >> Hi all, >> I have to write an application which does a move and >copy of a >> file from a remote machine to the local machine. I tried something >> like: >> >> file =3D ur"venuwin2008\\C\\4

Re: What way is the best to check an empty list?

2009-03-25 Thread Carl Banks
On Mar 25, 7:38 am, srinivasan srinivas wrote: > For ex: to check list 'A' is empty or not.. > if A == []: > if A.count == 0: > if len(A) == 0: > if not A: PEP 8 recommends the last one, and most Pythonistas here probably would as well, so that is probably what you should do if you don't otherwis

Re: What way is the best to check an empty list?

2009-03-25 Thread Carl Banks
On Mar 25, 8:27 am, Andre Engels wrote: > On Wed, Mar 25, 2009 at 4:21 PM, andrew cooke wrote: > > > but i may be wrong - are there any containers (apart from pathological > > hand-crafted examples) that would not define __len__()? > > When writing my answer, I thought of generators, but I now fi

Re: What way is the best to check an empty list?

2009-03-25 Thread Carl Banks
On Mar 25, 1:19 pm, "andrew cooke" wrote: > actually, the implication of what you said is probably worth emphasising > to the original poster: often you don't need to test whether a list is > empty or not, you simply iterate over its contents: > >   for x in foo: >     # do something > > this will

Re: What way is the best to check an empty list?

2009-03-25 Thread Martin P. Hellwig
Albert Hopkins wrote: On Wed, 2009-03-25 at 21:26 +, Martin P. Hellwig wrote: PEP 8 recommends the latter. Raymond I can't seem to find where this recommendation is mentioned or implied. Wow, you must not have looked very hard: 1. Point your browser to http://www.python.org/dev/pe

Re: setattr() on "object" instance

2009-03-25 Thread Aahz
In article <33f40372-13fb-4d52-921d-8ab00685c...@q30g2000prq.googlegroups.com>, Sean DiZazzo wrote: > >Why is it that you can setattr() on an instance of a class that >inherits from "object", but you can't on an instance of "object" >itself? > o = object() setattr(o, "x", 1000) >Traceba

Re: What way is the best to check an empty list?

2009-03-25 Thread Michiel Overtoom
On 25 Mar 2009, at 21:29 , Stef Mientki wrote: Now it would be nice to allow iteration over others too, like None . a = None for item in a : do_something_with_item I saw this technique used in CherryPy: >>> a=None >>> for item in a or []: ...print item ... >>> a=[1,2,3]

Re: A request (was: how to repeat function definitions less

2009-03-25 Thread alex goretoy
my messages are _not_ spam. -Alex Goretoy http://www.goretoy.com Robert Benchley - "I have tried to know absolutely nothing about a great many things, and I have succeeded fair... -- http://mail.python.org/mailman/listinfo/python-list

Re: What way is the best to check an empty list?

2009-03-25 Thread Albert Hopkins
On Wed, 2009-03-25 at 21:26 +, Martin P. Hellwig wrote: > > > > PEP 8 recommends the latter. > > > > > > Raymond > I can't seem to find where this recommendation is mentioned or implied. Wow, you must not have looked very hard: 1. Point your browser to http://www.python.org/dev/peps/p

Re: Cross platform installer builder for Python? (like IzPack for Java)

2009-03-25 Thread Gabriel Genellina
En Wed, 25 Mar 2009 17:28:30 -0300, W. Martin Borgert escribió: I'm looking for an installer builder similar to IzPack (which is based on Java). Isn't there anything like that in the Python world? Extra points, if GTK+ or wxWindows is used... To distribute modules/packages, I use distutils.

Re: py2exe - win32com - GetGeneratePath Error

2009-03-25 Thread Mark Hammond
On 26/03/2009 2:19 AM, Christopher Panici wrote: Has anyone solved the GetGeneratePath Error? I am getting this when I use win32com.client.DispatchWithEvents('iTunes.Application', customEventHandler). I have drilled down to the file and found it in that path. Does anyone have any ideas? HERE I

Re: Problem Python 2.6.1 vs 2.6 & pyWin32

2009-03-25 Thread Mark Hammond
On 25/03/2009 11:41 PM, John Machin wrote: This all sounds good. I presume that "this version of distutils" means the 2.6.2/3.1 version. Yep. In the meantime, until 2.6.2 final is released, is my suggestion of using Python 2.5 to build installers reasonable? Yep. Is there a better appro

Re: file open fails.

2009-03-25 Thread Scott David Daniels
afri...@yahoo.co.uk wrote: Wouldn't it be easier just to avoid the windows slashes altogether and stick to the posix: title = 'c:/thesis/refined_title.txt' Well, yes in a way, but lots of places in windows you can get a copy of a full file spec into the cut buffer, so you cut/paste rather than

Re: Relative Imports, why the hell is it so hard?

2009-03-25 Thread Carl Banks
On Mar 25, 1:07 am, Kay Schluehr wrote: > On 25 Mrz., 05:56, Carl Banks wrote: > > > > > > > On Mar 24, 8:32 pm, Istvan Albert wrote: > > > > On Mar 24, 9:35 pm, Maxim Khitrov wrote: > > > > > Works perfectly fine with relative imports. > > > > This only demonstrates that you are not aware of w

Re: What way is the best to check an empty list?

2009-03-25 Thread andrew cooke
Martin P. Hellwig wrote: > Raymond Hettinger wrote: >> On Mar 25, 7:38 am, srinivasan srinivas >> wrote: >>> if not A: >> PEP 8 recommends the latter. > I can't seem to find where this recommendation is mentioned or implied. it's the next-to-last sub-item, just before the references. http://www.p

Re: time.strptime() undocumented difference python 2.5.1>2.5.2

2009-03-25 Thread TYR
On Mar 25, 7:38 pm, MRAB wrote: > TYR wrote: > > A server that runs one of my programs was upgraded to Debian Lenny > > last night, which moved it from Python 2.4.4 to 2.5.2. This caused > > immediate trouble. At one point, data is parsed from a Web page, and > > among other things a time date gro

Re: What way is the best to check an empty list?

2009-03-25 Thread Martin P. Hellwig
Raymond Hettinger wrote: On Mar 25, 7:38 am, srinivasan srinivas wrote: For ex: to check list 'A' is empty or not.. if A == []: if A.count == 0: if len(A) == 0: if not A: PEP 8 recommends the latter. Raymond I can't seem to find where this recommendation is mentioned or implied. Personall

Re: Relative Imports, why the hell is it so hard?

2009-03-25 Thread Gabriel Genellina
En Tue, 24 Mar 2009 21:57:12 -0300, Istvan Albert escribió: On Mar 24, 3:16 pm, "Gabriel Genellina" wrote: Did you know, once a module is imported by the first time yeah yeah, could we not get sidetracked with details that are not relevant? what it obviously means is to import it in all of

Re: minor revision encoded in SONAME in libpython.so

2009-03-25 Thread szager
On Mar 24, 2:23 pm, "Martin v. Löwis" wrote: > > So, for example, if I upgrade to libpython2.6.so.1.1 > > How do you do that? There won't ever be such a library. They > will always be called libpython2.6.so.1.0. > > So no, no minor revision gets encoded into the SONAME. Then what's the significan

Re: Threading and tkinter

2009-03-25 Thread gert
On Mar 7, 9:40 am, Jani Hakala wrote: > > After reading the docs and seeing a few examples i think this should > > work ? > > Am I forgetting something here or am I doing something stupid ? > > Anyway I see my yellow screen, that has to count for something :) > > I have been using the following sc

Re: What way is the best to check an empty list?

2009-03-25 Thread Stef Mientki
andrew cooke wrote: Andre Engels wrote: On Wed, Mar 25, 2009 at 4:21 PM, andrew cooke wrote: i will go against the grain slightly and say that "len" is probably the best compromise in most situations (although i admit i don't know what [...] but i may be wrong - are there a

Cross platform installer builder for Python? (like IzPack for Java)

2009-03-25 Thread W. Martin Borgert
Hi, I'm looking for an installer builder similar to IzPack (which is based on Java). Isn't there anything like that in the Python world? Extra points, if GTK+ or wxWindows is used... TIA! -- http://mail.python.org/mailman/listinfo/python-list

Re: Mangle function name with decorator?

2009-03-25 Thread J. Cliff Dyer
On Wed, 2009-03-18 at 08:18 -0700, Adam wrote: > On Mar 18, 10:33 am, "J. Cliff Dyer" wrote: > > You might be interested in redefining __getattribute__(self, attr) on > > your class. This could operate in conjunction with the hash tables > > (dictionaries) mentioned by andrew cooke. i.e. (untest

Re: What way is the best to check an empty list?

2009-03-25 Thread andrew cooke
Andre Engels wrote: > On Wed, Mar 25, 2009 at 4:21 PM, andrew cooke wrote: >> i will go against the grain slightly and say that "len" is probably the >> best compromise in most situations (although i admit i don't know what [...] >> but i may be wrong - are there any containers (apart from patholo

Re: iteration without storing a variable

2009-03-25 Thread Stefan Behnel
Josh Dukes wrote: > $ python --version > Python 2.5.2 > > $ ruby --version > ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux] > > but I was more talking about the speed differences between ruby and python. I heard that Ruby 1.9 is supposed to be a lot faster than 1.8 in many aspects (as is

Re: What way is the best to check an empty list?

2009-03-25 Thread Raymond Hettinger
On Mar 25, 7:38 am, srinivasan srinivas wrote: > For ex: to check list 'A' is empty or not.. > if A == []: > if A.count == 0: > if len(A) == 0: > if not A: PEP 8 recommends the latter. Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: time.strptime() undocumented difference python 2.5.1>2.5.2

2009-03-25 Thread MRAB
TYR wrote: A server that runs one of my programs was upgraded to Debian Lenny last night, which moved it from Python 2.4.4 to 2.5.2. This caused immediate trouble. At one point, data is parsed from a Web page, and among other things a time date group is collected. This is in a nice human readable

Re: Another form of dynamic import

2009-03-25 Thread Anton Hartl
On 2009-03-25, Marco Nawijn wrote: > Hello, > > In short I would like to know if somebody knows if it is possible to > re-execute a statement that raised an exception? I will explain the > reason by providing a small introduction on why this might be nice in > my case > and some example code. > >

Re: iteration without storing a variable

2009-03-25 Thread Josh Dukes
well if we're interested in that... $ uname -a Linux IT2-JD 2.6.27-gentoo-r8 #1 SMP Tue Mar 17 14:28:19 PDT 2009 x86_64 Intel(R) Pentium(R) D CPU 2.80GHz GenuineIntel GNU/Linux $ python --version Python 2.5.2 $ ruby --version ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux] but I was more

time.strptime() undocumented difference python 2.5.1>2.5.2

2009-03-25 Thread TYR
A server that runs one of my programs was upgraded to Debian Lenny last night, which moved it from Python 2.4.4 to 2.5.2. This caused immediate trouble. At one point, data is parsed from a Web page, and among other things a time date group is collected. This is in a nice human readable format, but

Re: iteration without storing a variable

2009-03-25 Thread Stefan Behnel
Josh Dukes wrote: > $ time python -c 'a = "A"; > for r in xrange(10): a += "A" ' > > real 0m0.109s > user 0m0.100s > sys 0m0.010s > > Anyone get different results? Sure: $ time python -c 'a = "A"; for r in xrange(10): a += "A" ' real0m0.140s user0m0.132s sys 0m0.008s

Re: Another form of dynamic import

2009-03-25 Thread Albert Hopkins
Also, instead of caching exceptions you can do lazy lookups kinda like this: - # a.py class A: pass - # b.py class B:

iteration without storing a variable

2009-03-25 Thread Josh Dukes
So The metasploit framework was suffering from some performance issues which they fixed. http://www.metasploit.com/blog/ I was interested in comparing this to python. Language comparisons are not generally very useful for a number of reasons, but some might find this interesting. Clearly the pyt

Re: Another form of dynamic import

2009-03-25 Thread Terry Reedy
Marco Nawijn wrote: In short I would like to know if somebody knows if it is possible to re-execute a statement that raised an exception? In short, no. As an example, look at the following statement aPoint = gp_Pnt(1.0, 0.0, 0.0) # Oops, this will raise a NameError, since

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread Terry Reedy
MRAB wrote: Python Newsgroup wrote: Gotcha, I got started from the telnet example listed in the docs. The linux install was via yum and installed 2.x instead. That explains it. Althought print (tn.read_all () ) runs in 2.x on linux. I have another problem maybe you cna help me with. My telnet

Re: Another form of dynamic import

2009-03-25 Thread pruebauno
On Mar 25, 10:23 am, Marco Nawijn wrote: > Hello, > > In short I would like to know if somebody knows if it is possible to > re-execute a statement that raised an exception? I will explain the > reason by providing a small introduction on why this might be nice in > my case > and some example code

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread MRAB
Python Newsgroup wrote: Gotcha, I got started from the telnet example listed in the docs. The linux install was via yum and installed 2.x instead. That explains it. Althought print (tn.read_all () ) runs in 2.x on linux. I have another problem maybe you cna help me with. My telnet output jibb

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread Python Newsgroup
Gotcha, I got started from the telnet example listed in the docs. The linux install was via yum and installed 2.x instead. That explains it. Althought print (tn.read_all () ) runs in 2.x on linux. I have another problem maybe you cna help me with. My telnet output jibberish in windows: I cna p

Re: *args question

2009-03-25 Thread Dave Angel
Try the following, to call your function yourself in this way: def myfunction(string,sleeptime,*args): while 1: print "string is ", string time.sleep(sleeptime) #sleep for a specified amount of time. f = myfunction r = ("Thread No:1",2) f(*r) The key here is the *r synt

Re: distutils compiler flags for extension modules

2009-03-25 Thread Christian Meesters
Thanks! I'll try that. Sorry for replying so late - just didn't get to it. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: *args question (correction)

2009-03-25 Thread Tim Chase
thread.start_new_thread(myfunc, "some string", 42) This should have been thread.start_new_thread(myfunc, ("some string", 42)) because all the subsequent values after the function-handle/name get passed into the function when it gets called. As if the start_new_thread() function was def

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread Python Newsgroup
Thats newbe experience for ya ;-) thanks. Its seems to work and leads to another question. whether running the script or stepping thru the process at the command line I get what looks like hex C:\Python30>python \Python30\scripts\telnet-tftp1.py b'\x1b[24;1H\x1b[24;31H\x1b[24;1H\x1b[?25h\x1b[24

Re: Another form of dynamic import

2009-03-25 Thread Kay Schluehr
On 25 Mrz., 15:23, Marco Nawijn wrote: > Hello, > > In short I would like to know if somebody knows if it is possible to > re-execute a statement that raised an exception? I will explain the > reason by providing a small introduction on why this might be nice in > my case > and some example code.

Re: *args question

2009-03-25 Thread Tim Chase
Maybe I'm missing it, but in the original code, the line had thread.start_new_thread(myfunction,("Thread No:1",2)) It has a single arg ("Thread No:1",2) versus something like thread.start_new_thread(myfunction,1, 2, ("Thread No:1",2)) But def myfunction(string,sleeptime,*args): clearly take

Re: Problems with threaded Hotkey application

2009-03-25 Thread Michael Torrie
Anita Whitney wrote: > A window comes up saying "hotkeyapp has stopped working." How do I > get in there to "move the RegisterHotKey line to within the thread's > run method," etc.? Im trying to do this myself and not pay Acer tech > support. Thanks, Anita Whitney Is this a wxPython application t

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread MRAB
Python Newsgroup wrote: I'm a total newbe to scripting not to mention python. However I was able to successfully create a telnet script to initiate login, initiate tftp, exit, exit, confirm and close session. Frustrated, possibly causing my own misery. I replace the sript the script with the st

Re: Debugging in Py

2009-03-25 Thread Tim Chase
I'm just wondering if you all have any resources on Debugging that you all would "recommend." Due to the fact I'm doing some debugging as a beginner and this has the best of me, and I'm looking at trying to learn more about what and how to debug within Py using print, and etc... For most of what

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread Gary Herron
Python Newsgroup wrote: I'm a total newbe to scripting not to mention python. However I was able to successfully create a telnet script to initiate login, initiate tftp, exit, exit, confirm and close session. Frustrated, possibly causing my own misery. I replace the sript the script with the s

Re: *args question

2009-03-25 Thread grocery_stocker
On Mar 25, 8:28 am, Tim Chase wrote: > grocery_stocker wrote: > > On Mar 25, 7:05 am, grocery_stocker wrote: > >> Given the following code... > > >> #!/usr/bin/env python > > >> import time > >> import thread > > >> def myfunction(string,sleeptime,*args): > >> while 1: > > >> print st

SyntaxError: invalid syntax (windows)

2009-03-25 Thread Python Newsgroup
I'm a total newbe to scripting not to mention python. However I was able to successfully create a telnet script to initiate login, initiate tftp, exit, exit, confirm and close session. Frustrated, possibly causing my own misery. I replace the sript the script with the standard example. import

Re: What way is the best to check an empty list?

2009-03-25 Thread John Machin
On Mar 26, 2:21 am, "andrew cooke" wrote: > i will go against the grain slightly and say that "len" is probably the > best compromise in most situations (although i admit i don't know what > count is) because i think it will work when you expect it to and break > when you have a bug in your progra

Re: *args question

2009-03-25 Thread Tim Chase
grocery_stocker wrote: On Mar 25, 7:05 am, grocery_stocker wrote: Given the following code... #!/usr/bin/env python import time import thread def myfunction(string,sleeptime,*args): while 1: print string time.sleep(sleeptime) #sleep for a specified amount of time. if __

Re: What way is the best to check an empty list?

2009-03-25 Thread Andre Engels
On Wed, Mar 25, 2009 at 4:21 PM, andrew cooke wrote: > > i will go against the grain slightly and say that "len" is probably the > best compromise in most situations (although i admit i don't know what > count is) because i think it will work when you expect it to and break > when you have a bug i

Re: Does __init__ of subclass need the same argument types as __init__ of base class?

2009-03-25 Thread Sibylle Koczian
Bruno Desthuilliers schrieb: > Sibylle Koczian a écrit : > (snip) >> >> >> The print command inside the __init__ method isn't executed, so that >> method doesn't seem to start at all. > > this often happens with (usually C-coded) immutable types. The > initializer is not called, only the "proper"

Re: *args question

2009-03-25 Thread John Machin
On Mar 26, 1:17 am, grocery_stocker wrote: > On Mar 25, 7:05 am, grocery_stocker wrote: > > > > > Given the following code... > > > #!/usr/bin/env python > > > import time > > import thread > > > def myfunction(string,sleeptime,*args): > >     while 1: > > >         print string > >         time.

Debugging in Py

2009-03-25 Thread *nixtechno
I'm just wondering if you all have any resources on Debugging that you all would "recommend." Due to the fact I'm doing some debugging as a beginner and this has the best of me, and I'm looking at trying to learn more about what and how to debug within Py using print, and etc... There is so much o

py2exe - win32com - GetGeneratePath Error

2009-03-25 Thread Christopher Panici
Has anyone solved the GetGeneratePath Error? I am getting this when I use win32com.client.DispatchWithEvents('iTunes.Application', customEventHandler). I have drilled down to the file and found it in that path. Does anyone have any ideas? HERE IS THE ERROR. If anyone is good at this please

Re: What way is the best to check an empty list?

2009-03-25 Thread andrew cooke
i will go against the grain slightly and say that "len" is probably the best compromise in most situations (although i admit i don't know what count is) because i think it will work when you expect it to and break when you have a bug in your program. using a simple boolean is more robust (and wha

Re: Does __init__ of subclass need the same argument types as __init__ of base class?

2009-03-25 Thread Hrvoje Niksic
Bruno Desthuilliers writes: >> The print command inside the __init__ method isn't executed, so that >> method doesn't seem to start at all. > > this often happens with (usually C-coded) immutable types. The > initializer is not called, only the "proper" constructor (__new__). More specifically,

Re: What way is the best to check an empty list?

2009-03-25 Thread John Machin
On Mar 26, 1:38 am, srinivasan srinivas wrote: Depends on what you mean by "best"; like graduation day at kindergarten, everyone gets a prize: > For ex: to check list 'A' is empty or not.. > if A == []: most obviously correct > if A.count == 0: best use of imagination > if len(A) == 0: best

Re: What way is the best to check an empty list?

2009-03-25 Thread bearophileHUGS
srinivasan srinivas: > For ex: to check list 'A' is empty or not.. Empty collections are "false": if somelist: ... # somelist isn't empty else: ... # somelist is empty Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: What way is the best to check an empty list?

2009-03-25 Thread Tim Chase
srinivasan srinivas wrote: For ex: to check list 'A' is empty or not.. if A == []: if A.count == 0: if len(A) == 0: if not A: "if not A" -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: What way is the best to check an empty list?

2009-03-25 Thread Andre Engels
On Wed, Mar 25, 2009 at 3:38 PM, srinivasan srinivas wrote: > > For ex: to check list 'A' is empty or not.. > if A == []: > if A.count == 0: > if len(A) == 0: > if not A: I would go for the last one, because it has the highest likelihood of doing what is intended when fed with something that is '

Re: How can I know if a date is prior to today?

2009-03-25 Thread John Machin
On Mar 26, 12:51 am, Tim Chase wrote: > > I have a date expressed in seconds. > > I'd want to pretty print it as "%H:%M" if the time refers to today and > > "%b%d" (month, day) if it's of yesterday or before. > > > I managed to do that with the code below but I don't like it too much. > > Is there

What way is the best to check an empty list?

2009-03-25 Thread srinivasan srinivas
For ex: to check list 'A' is empty or not.. if A == []: if A.count == 0: if len(A) == 0: if not A: Thanks, Srini Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/ -- http://mail.python.org/mailman/listinfo/python-list

Problems with threaded Hotkey application

2009-03-25 Thread Anita Whitney
A window comes up saying "hotkeyapp has stopped working." How do I get in there to "move the RegisterHotKey line to within the thread's run method," etc.? Im trying to do this myself and not pay Acer tech support. Thanks, Anita Whitney-- http://mail.python.org/mailman/listinfo/python-list

Re: blocked on futex

2009-03-25 Thread Aahz
In article <5cffe00b-2cd3-45dc-a674-87466e8ff...@f19g2000vbf.googlegroups.com>, msoulier wrote: >On Mar 20, 10:22=A0am, a...@pythoncraft.com (Aahz) wrote: >> >> Have you tried dumping core and using gdb to find out more about the >> process state? > >Yeah, just did. I need the debuginfo for prop

Another form of dynamic import

2009-03-25 Thread Marco Nawijn
Hello, In short I would like to know if somebody knows if it is possible to re-execute a statement that raised an exception? I will explain the reason by providing a small introduction on why this might be nice in my case and some example code. I am using the python bindings to a *very* large C++

Re: integrate does not work anymore

2009-03-25 Thread Ulrich Eckhardt
Doerte wrote: > from pylab import * > from numpy import * > from scipy import * > from math import * Don't do this, read the style guide on writing Python code. > res = integrate.quad(func=f, a=x0, b=x1) [...] > NameError: name 'integrate' is not defined # try this instead from scipy import inte

Re: How can I know if a date is prior to today?

2009-03-25 Thread Giampaolo Rodola'
On 25 Mar, 14:51, Tim Chase wrote: > > I have a date expressed in seconds. > > I'd want to pretty print it as "%H:%M" if the time refers to today and > > "%b%d" (month, day) if it's of yesterday or before. > > > I managed to do that with the code below but I don't like it too much. > > Is there a

Re: *args question

2009-03-25 Thread grocery_stocker
On Mar 25, 7:05 am, grocery_stocker wrote: > Given the following code... > > #!/usr/bin/env python > > import time > import thread > > def myfunction(string,sleeptime,*args): > while 1: > > print string > time.sleep(sleeptime) #sleep for a specified amount of time. > > if __nam

*args question

2009-03-25 Thread grocery_stocker
Given the following code... #!/usr/bin/env python import time import thread def myfunction(string,sleeptime,*args): while 1: print string time.sleep(sleeptime) #sleep for a specified amount of time. if __name__=="__main__": thread.start_new_thread(myfunction,("Thread N

integrate does not work anymore

2009-03-25 Thread Doerte
Hello, some time ago I implemented a Python script, which uses integrate.quad (...). This was done with Python 2.4 / Win2000. I'm working with Python 2.5 now, and installed Numpy, Scipy and Matplotlib. My script and also the test described below do not work anymore: from pylab import * from nump

Re: Unicode problem in ucs4

2009-03-25 Thread abhi
On Mar 24, 4:55 am, "Martin v. Löwis" wrote: > > So, both Py_UNICODE and wchar_t are 4 bytes and since it contains 3 > > \0s after a char, printf or wprintf is only printing one letter. > > No. printf indeed will see a terminating character. However, wprintf > should correctly know that a wchar_t

Re: fft of a dat file?

2009-03-25 Thread R. David Murray
Soumen banerjee wrote: > Hello > I have not tried the code because in no part of the code is the array > "out" being created. As such, it is bound to return an error that out > isnt created. The point here is how i can get sampled values from the > dat file which has lines like this:- > >

Re: How can I know if a date is prior to today?

2009-03-25 Thread Tim Chase
I have a date expressed in seconds. I'd want to pretty print it as "%H:%M" if the time refers to today and "%b%d" (month, day) if it's of yesterday or before. I managed to do that with the code below but I don't like it too much. Is there a better way to do that? Thanks in advance. import time

  1   2   >