Re: return a value to shell script

2008-11-12 Thread Tom Wright
devi thapa wrote: > I am executing a python script in a shell script. The python script > actually returns a value. > So, can I get the return value in a shell script? If yes, then help me > out. Yes. The variable $? should be bound to the return value of the last foreground program to exit. Th

Re: matplotlib question

2008-06-12 Thread Tom Wright
asdf wrote: > basically I need to plot a graph of data vs time. However when i use > matplotlib the hr:min tick marks come out very close together and > appear jumbled. You need to look up the matplotlib.dates package - it's covered briefly in the tutorial at http://matplotlib.sourceforge.net/tuto

Re: Licence confusion: distributing MSVC?71.DLL

2008-03-07 Thread Tom Wright
jim-on-linux wrote: > This is what someone wrote on 1-21-2007 > to this help site about this pain in the a... > MSVCR71 stuff. > > " I believe this problem doesn't exist. > (snip useful bit of EULA and explanation) Thanks for that - just what I didn't manage to turn up with Google. I'll go ahead

Re: Licence confusion: distributing MSVC?71.DLL

2008-03-06 Thread Tom Wright
Gabriel Genellina wrote: > Maybe this thread > http://groups.google.com/group/comp.lang.python/browse_thread/thread/f8df5ed32b324a3f/ > can help. > > This EULA doesn't apply to you, but to the Python developers, which are > the actual Visual Studio users and have to comply with its license terms.

Re: Licence confusion: distributing MSVC?71.DLL

2008-03-06 Thread Tom Wright
Tom Wright wrote: > If someone has worked their way through this maze before and has an > answer, I'd be keen to hear it. Hmm, an answer of sorts: Inkscape's Windows build comes with MSVCR70.dll and MSVCR71.dll (but not MSVCP71.dll). As it's a big and high-profile project d

Licence confusion: distributing MSVC?71.DLL

2008-03-06 Thread Tom Wright
Hi I've written a program in Python using wxPython and Matplotlib and would like to distribute it under the GPL. For ease of use, I'd also like to distribute and installable version for Windows, but this needs MSVCR71.dll and MSVCP71.dll to work. I've created an installer using py2exe and Inno S

Re: recursion

2007-09-13 Thread Tom Wright
Gigs_ wrote: > Can someone explain me this > def f(l): > if l == []: > return [] > else: > return f(l[1:]) + l[:1] # <= cant figure this, how is > all sum at the end? If you think about building up from the simplest case: f([]) = [] f(['a']) = f([])

Re: Garbage collection

2007-03-21 Thread Tom Wright
[EMAIL PROTECTED] wrote: > If your program's behavior is: > > * allocate a list of 1e7 ints > * delete that list > > how does the Python interpreter know your next bit of execution won't be > to repeat the allocation? It doesn't know, but if the program runs for a while without repeating

Re: Garbage collection

2007-03-21 Thread Tom Wright
Steve Holden wrote: > Easy to say. How do you know the memory that's not in use is in a > contiguous block suitable for return to the operating system? I can > pretty much guarantee it won't be. CPython doesn't use a relocating > garbage collection scheme Fair point. That is difficult and I don't

Re: Garbage collection

2007-03-21 Thread Tom Wright
Steven D'Aprano wrote: > You've described an extremely artificial set of circumstances: you create > 40,000,000 distinct integers, then immediately destroy them. The obvious > solution to that "problem" of Python caching millions of integers you > don't need is not to create them in the first place

Re: Garbage collection

2007-03-21 Thread Tom Wright
[EMAIL PROTECTED] wrote: > Tom> ...and then I allocate a lot of memory in another process (eg. > open Tom> a load of files in the GIMP), then the computer swaps the > Python > Tom> process out to disk to free up the necessary space. Python's > Tom> memory use is still reported

Re: Garbage collection

2007-03-21 Thread Tom Wright
[EMAIL PROTECTED] wrote: > You haven't forgotten to do anything. Your attempts at freeing memory are > being thwarted (in part, at least) by Python's int free list. I believe > the int free list remains after the 10M individual ints' refcounts drop to > zero. The large storage for the list is gra

Re: Garbage collection

2007-03-21 Thread Tom Wright
Thinker wrote: > How do you know amount of memory used by Python? > ps ? top or something? $ ps up `pidof python2.5` USER PID %CPU %MEMVSZ RSS TTY STAT START TIME COMMAND tew2426275 0.0 11.9 257592 243988 pts/6 S+ 13:10 0:00 python2.5 "VSZ" is "Virtual Memory Size" (

Re: Technical Answer - Protecting code in python

2007-03-21 Thread Tom Wright
flit wrote: > 1 - There is a way to make some program in python and protects it? I > am not talking about ultra hard-core protection, just a simple one > that will stop 90% script kiddies. Put it in an executable? It's more hidden than protected, but it will stop a fair few non-experts. I use and

Garbage collection

2007-03-21 Thread Tom Wright
Hi all I suspect I may be missing something vital here, but Python's garbage collection doesn't seem to work as I expect it to. Here's a small test program which shows the problem on python 2.4 and 2.5: $ python2.5 Python 2.5 (release25-maint, Dec 9 2006, 15:33:01) [GCC 4.1.2 20061115 (prerele

Re: select windows

2007-01-30 Thread Tom Wright
Dennis Lee Bieber wrote: > (And the Amiga could add even more complexity -- I still miss the > Amiga's ability to PUSH a window to the back while STILL KEEPING > FOCUS... Made it easy to type stuff into one window while reading data > from a covering window!) KDE's window manager can do this (and

Re: How to find out if another process is using a file

2007-01-19 Thread Tom Wright
Jean-Paul Calderone wrote: > A better solution is to name or place files which are begin written in a > which is recognizable and only rename or move them to their final location > when they have been completely written. > > For example, name files ".new" as they are being written. When they are

Re: How to find out if another process is using a file

2007-01-19 Thread Tom Wright
js wrote: > How about using lock? > Let writing process locks the files before writing, and unlock after > the job's done. Is locking mandatory or co-operative? I don't have any control over the process which is doing the writing, so if it's co-operative it's no good to me. If it's mandatory, th

How to find out if another process is using a file

2007-01-18 Thread Tom Wright
I'm writing a program which reads a series of data files as they are dumped into a directory by another process. At the moment, it gets sporadic bugs when it tries to read files which are only partially written. I'm looking for a function which will tell me if a file is opened in write-mode by an

Default event handlers in wxPython

2007-01-15 Thread Tom Wright
Hi all I'm writing my first wxPython app and am having a problem with event handlers. I've set up a multi-part status bar and would like all the tooltips, menu help strings etc. to go into the second part of it. Is there some easy way of doing this? I've not found one, so have set up the follow