Re: spawning pyhon apps...

2009-01-09 Thread Jason Scheirer
On Jan 9, 3:43 pm, "bruce" wrote: > hi jason > > forgive me... but in your sample: >         my_popenobjects = [subprocess.Popen("foo.py", "--filename=file >         %i.txt"%x) for x in xrange(10)] > are you spawning 'foo.py' 10 times? that can't be right! > so just what is "foo.py" used for?

Re: Why can't I store a DLL in a module library Zip file?

2009-01-09 Thread Martin v. Löwis
> It's almost like shared libraries are disallowed from the module > library Zip format. Correct. That's a limitation of the Windows operating system, which can load DLLs only from plain, regular files. Python can load .py files from zip files because it implements the loading itself. For DLL load

RE: spawning pyhon apps...

2009-01-09 Thread bruce
thanks jason or i could also, simply iterate through a loop of the names of the "child processes" i want to spawn, using the names in the subprocess.popen, and then proceeding with the rest of your example.. question though... if i have a child app that's hanging.. how do i kill it. or is th

Re: Problem with -3 switch

2009-01-09 Thread John Machin
On Jan 10, 6:58 am, Carl Banks wrote: > On Jan 9, 12:36 pm, "J. Cliff Dyer" wrote: > > > > > > > On Fri, 2009-01-09 at 13:13 -0500, Steve Holden wrote: > > > Aivar Annamaa wrote: > > > >> As was recently pointed out in a nearly identical thread, the -3 > > > >> switch only points out problems tha

Re: spawning pyhon apps...

2009-01-09 Thread Jason Scheirer
On Jan 9, 4:07 pm, "bruce" wrote: > thanks jason > > or i could also, simply iterate through a loop of the names of the "child > processes" i want to spawn, using the names in the subprocess.popen, and > then proceeding with the rest of your example.. > > question though... if i have a child a

Re: why cannot assign to function call

2009-01-09 Thread Joe Strout
Mark Wooding wrote: As an aside, I don't notice anywhere near as much confusion in Lisp and Scheme groups, which might be surprising since Lisp and Scheme have precisely the same data model, argument passing convention, and assignment semantics, as Python has. Nor is there anywhere near as muc

Re: why cannot assign to function call

2009-01-09 Thread rurpy
Joe Strout wrote: > ru...@yahoo.com wrote: > >>> I never claimed that you *couldn't* have copy semantics in C; you can do >>> almost anything you want in C (or C++). But the *normal* usage of an >>> array is via a pointer, in which case the semantics are exactly the same >>> as in Python, Java, RE

Re: why cannot assign to function call

2009-01-09 Thread Benjamin Kaplan
On Fri, Jan 9, 2009 at 7:11 PM, Joe Strout wrote: > Mark Wooding wrote: > > > .NET isn't a language at all: >> rather, it's a virtual machine, runtime system, class library and family >> of languages each of which may have idiosyncratic semantics. >> > > But they don't, AFAIK -- they all have th

Re: spawning pyhon apps...

2009-01-09 Thread Mark Wooding
bruce wrote: > toying with an idea.. trying to figure out a good/best way to spawn > multiple python scripts from a parent python app. i'm trying to figure > out how to determine when all child apps have completed, or to > possibly determine if any of the child processes have died/halted.. You d

Re: BadZipfile "file is not a zip file"

2009-01-09 Thread John Machin
On Jan 10, 9:52 am, webcomm wrote: > On Jan 9, 5:21 pm, John Machin wrote: > > > Thanks. Would you mind spending a few minutes more on this so that we > > can see if it's a problem that can be fixed easily, like the one that > > Chris Mellon reported? > > Don't mind at all.  I'm now working with

Common path all PyObjects take on destruction?

2009-01-09 Thread Ryan Stutsman
I've added a field to all PyObjects in the interpreter which is of type PyObject*. Most of the time this pointer is NULL but occassionally I want to track some information in there. The problem I'm running into is that I can add a reference to a PyObject inside any of my PyObjects, but it seems

Re: Python 2.6 fails on compiling > Bug report

2009-01-09 Thread googler . 1 . webmaster
hi, thanks for your help. May the diff file is wrong? on my system it doesn't work. Well, set the -enable-universalsdk= path occurs that error. Hmm. that is really a disaster, isn't it :( hm. -- http://mail.python.org/mailman/listinfo/python-list

how to remove 'FFFD' character

2009-01-09 Thread webcomm
Does anyone know a way to remove the 'FFFD' character with python? You can see the browser output I'm dealing with here: http://webcomm.webfactional.com/htdocs/fffd.JPG I deleted a big chunk out of the middle of that JPG to protect sensitive data. I don't know what the character encoding of this

Re: why cannot assign to function call

2009-01-09 Thread Steven D'Aprano
On Fri, 09 Jan 2009 21:03:39 +, Mark Wooding wrote: > Steven D'Aprano wrote: > >> Python doesn't do the same thing as C. It actually passes the same >> value to the function, without copying it. >> >> Why oh why do you keep insisting that Python is no different from C? > > I'm beginning to

Re: why cannot assign to function call

2009-01-09 Thread Grant Edwards
On 2009-01-10, Joe Strout wrote: > Mark Wooding wrote: > >> As an aside, I don't notice anywhere near as much confusion in Lisp and >> Scheme groups, which might be surprising since Lisp and Scheme have >> precisely the same data model, argument passing convention, and >> assignment semantics, as

Re: Implementing file reading in C/Python

2009-01-09 Thread John Machin
On Jan 9, 9:56 pm, mk wrote: > The factor of 30 indeed does not seem right -- I have done somewhat > similar stuff (calculating Levenshtein distance [edit distance] on words > read from very large files), coded the same algorithm in pure Python and > C++ (using linked lists in C++) and Python ver

Re: Python 2.6 fails on compiling > Bug report

2009-01-09 Thread Ned Deily
In article , googler.1.webmas...@spamgourmet.com wrote: > May the diff file is wrong? on my system it doesn't work. > Well, set the -enable-universalsdk= path occurs that error. Sorry, there were a few line wrap-arounds in the diff file due to long lines but the changes for the four significant

Re: Python 2.6 fails on compiling > Bug report

2009-01-09 Thread googler . 1 . webmaster
Hi! :) >Sorry, there were a few line wrap-arounds in the diff file due to long >lines but the changes for the four significant lines should be easy to >do manually. Hadn't done that before but I found a ressource how to read that syntax. x86_64 would be enough. i test that again. Thank you. :) -

download timeout vs. socket timeout

2009-01-09 Thread p.
i'm using urllib2 in python 2.4 wondering how people typically deal with the case in which a download is too slow. setting the socket timeout only covers those cases where there is no response in the socket for whatever the timeout period is. what if, however, i'm getting bits back but want simply

Re: download timeout vs. socket timeout

2009-01-09 Thread Gabriel Genellina
En Sat, 10 Jan 2009 00:07:15 -0200, p. escribió: i'm using urllib2 in python 2.4 wondering how people typically deal with the case in which a download is too slow. setting the socket timeout only covers those cases where there is no response in the socket for whatever the timeout period is. wh

Re: download timeout vs. socket timeout

2009-01-09 Thread MRAB
p. wrote: i'm using urllib2 in python 2.4 wondering how people typically deal with the case in which a download is too slow. setting the socket timeout only covers those cases where there is no response in the socket for whatever the timeout period is. what if, however, i'm getting bits back but

Detecting open files and forcing closure

2009-01-09 Thread Andrew Robert
Hi Everyone, We have a process that does a copy of a share from one location to another. This usually works fine but can occasionally bomb if a file is opened by a user somewhere. Is there a way to code detection of open files and force a close? The files in question are typically PDF files

Re: why cannot assign to function call

2009-01-09 Thread Rhodri James
On Sat, 10 Jan 2009 00:21:27 -, wrote: Joe Strout wrote: ru...@yahoo.com wrote: [snip] Pointers are passed and assigned by value, just as other types (disputedly except arrays) are. One can then use that pointer to manually effect pass-(the-value-pointed-to)-by-reference, or sharing, e

Re: why cannot assign to function call

2009-01-09 Thread Mark Wooding
Joe Strout wrote: > No, actually, that was me. rurpy's list was something like C, FORTRAN, > Perl, and VBA. My mistake -- I failed to read the quoting properly. Apologies to all. We still dealt with C. Fortran (to give it its modern spelling) has a similar data model to C, but passes argume

Re: why cannot assign to function call

2009-01-09 Thread Mark Wooding
Steven D'Aprano wrote: > Er, perhaps you missed that I was replying to Joe Strout. Yes, evidently. My apologies for the mix up! -- [mdw], who obviously should put the keyboard down now. -- http://mail.python.org/mailman/listinfo/python-list

Re: why cannot assign to function call

2009-01-09 Thread rurpy
Mark Wooding wrote: > ru...@yahoo.com wrote: > >> If one accepts that there are a "lot" of people who post in here that >> clearly are surprised by Python's assignment semantics, > > But one should not accept that. One might accept that there are many > who post who claim that they are surprised

Re: Detecting open files and forcing closure

2009-01-09 Thread MRAB
Andrew Robert wrote: Hi Everyone, We have a process that does a copy of a share from one location to another. This usually works fine but can occasionally bomb if a file is opened by a user somewhere. Is there a way to code detection of open files and force a close? The files in question are

Re: Detecting open files and forcing closure

2009-01-09 Thread Andrew Robert
MRAB wrote: Andrew Robert wrote: Hi Everyone, We have a process that does a copy of a share from one location to another. This usually works fine but can occasionally bomb if a file is opened by a user somewhere. Is there a way to code detection of open files and force a close? The files in

Re: Jython 2.5 Beta1 Released!

2009-01-09 Thread Matthew Nuzum
On Fri, Jan 9, 2009 at 3:37 PM, Frank Wierzbicki wrote: > On behalf of the Jython development team, I'm pleased to announce that > Jython 2.5b1 is available for download: > http://downloads.sourceforge.net/jython/jython_installer-2.5b1.jar. > See the installation instructions here: > http://www.jy

Re: why cannot assign to function call

2009-01-09 Thread rurpy
Rhodri James wrote: > On Sat, 10 Jan 2009 00:21:27 -, wrote: >> IIRC, Someone posted here that his experience was >> that 12-year old kids (presumably without programming >> experience) had no problem with Python and references >> when described as "names given to an object". (From >> memory,

Mocking `from foo import *` functions

2009-01-09 Thread Silfheed
So I'm in the current testing situation: sender.py: - def sendEmails(): return "I send emails" alerter.py: - from sender import * def DoStuffAndSendEmails(): doStuff() sendEmails() I'm trying to write a test fn that will test DoStuffAndSendEmails() (as well as it's

Re: Mocking `from foo import *` functions

2009-01-09 Thread MRAB
Silfheed wrote: So I'm in the current testing situation: sender.py: - def sendEmails(): return "I send emails" alerter.py: - from sender import * def DoStuffAndSendEmails(): doStuff() sendEmails() I'm trying to write a test fn that will test DoStuffAndSendEmails(

Re: Common path all PyObjects take on destruction?

2009-01-09 Thread Carl Banks
On Jan 9, 6:39 pm, Ryan Stutsman wrote: > I've added a field to all PyObjects in the interpreter which is of type > PyObject*.  Most of the time this pointer is NULL but occassionally I > want to track some information in there.  The problem I'm running into > is that I can add a reference to a Py

Re: Mocking `from foo import *` functions

2009-01-09 Thread Rob Williscroft
Silfheed wrote in news:c73b304b-f601-4bb5-89c1-3ee667eeb7d9 @l37g2000vba.googlegroups.com in comp.lang.python: > So I'm in the current testing situation: > > sender.py: > - > def sendEmails(): >return "I send emails" > > alerter.py: > - > from sender import * > def Do

Re: "python -3" not working as expected

2009-01-09 Thread Benjamin
On Jan 8, 11:35 pm, John Machin wrote: > On Jan 9, 1:56 pm, Benjamin wrote: > > > On Jan 8, 4:21 pm, Thorsten Kampe wrote: > > > > * Terry Reedy (Thu, 08 Jan 2009 17:04:04 -0500) > > > > Since you are, I believe, at least the second person to report being bit > > > > by this confusion, please op

Re: "python -3" not working as expected

2009-01-09 Thread John Machin
On Jan 10, 2:55 pm, Benjamin wrote: > On Jan 8, 11:35 pm, John Machin wrote: > > > Actually, don't bother now; I've fixed it up in the trunk. > > > Would you mind giving a pointer to where or what your fix is? The > > reason for asking is that Thorsten's suggestion is ambiguous: warn > > about s

Re: Detecting open files and forcing closure

2009-01-09 Thread Rhodri James
On Sat, 10 Jan 2009 03:06:03 -, Andrew Robert wrote: The usual scenario is that a user will leave a PDF open and then go home for the evening. They are simply viewing and not modifying the file. When the XCOPY executes, it signals a failure and subsequent scheduler job abend. What

Re: Mocking `from foo import *` functions

2009-01-09 Thread hsoft
On Jan 10, 4:21 am, Silfheed wrote: > So I'm in the current testing situation: > > sender.py: > - > def sendEmails(): >    return "I send emails" > > alerter.py: > - > from sender import * > def DoStuffAndSendEmails(): >   doStuff() >   sendEmails() > > I'm trying to write

Re: Free Download - Microsoft Windows 7 Beta

2009-01-09 Thread M�ta-MCI (MVP)
Hi! I downloaded W7 two days ago, directly on MSDN (Microsoft), and not on a bizarre, unknown site, and doubtful. Python 2.6 run OK. But the problem (well known) with Python 2.6.1 is always present. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing and SIGINT

2009-01-09 Thread Gabriel Genellina
En Fri, 09 Jan 2009 03:04:58 -0200, akineko escribió: (2) test program with multiprocessing Both processes receives SIGINT. OS apparently distributes the SIGINT event to processes associated with the terminal. Yes, to avoid that, the child process has to detach itself from the terminal. I'd

Re: Implementing file reading in C/Python

2009-01-09 Thread Rhamphoryncus
On Jan 9, 2:14 pm, Marc 'BlackJack' Rintsch wrote: > On Fri, 09 Jan 2009 15:34:17 +, MRAB wrote: > > Marc 'BlackJack' Rintsch wrote: > > >> def iter_max_values(blocks, block_count): > >>     for i, block in enumerate(blocks): > >>         histogram = defaultdict(int) > >>         for byte in b

Re: BadZipfile "file is not a zip file"

2009-01-09 Thread Steven D'Aprano
On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote: > The error... ... > BadZipfile: File is not a zip file > > When I look at data.zip in Windows, it appears to be a valid zip file. > I am able to uncompress it in Windows XP, and can also uncompress it > with 7-Zip. It looks like zipfile is not

Re: ulimit stack size and python threads

2009-01-09 Thread Martin v. Löwis
> Always crashing because I asked the OS to please not allow a process > to grow too big is what I call overloading the meaning of ulimit -s. Please trust that there is no explicit code in the Python interpreter that tests whether the stack size is 4GB, and then produces an explicit crash. > It's

Re: ulimit stack size and python threads

2009-01-09 Thread Martin v. Löwis
> I see. I should be blaming the default behavior of pthreads. You shouldn't blame anybody. Instead, you should sit down and study the problem in detail, until you fully understand it. Then you should start contributing fixes. Never ever should you spread blame. Regards, Martin -- http://mail.py

Encrypted Logging in python

2009-01-09 Thread koranthala
I was wondering if there is a mechanism to encrypt logging automatically in python. The issue is as follows: (a) An application (after py2exe) will go as executable and there is no need for the user to know that it is written in python. If an exception occurs and it is logged, then the us

Re: threading in PyQt vs threading in standard library

2009-01-09 Thread Phil Thompson
On Fri, 9 Jan 2009 15:15:28 +0800, "Steven Woody" wrote: > Hi, > > I am considering using PyQt for GUI programs, and I notices that both > of them include threading supports, so which one should I pick up? > Similar also applies 'socket'. I'd recommend using the PyQt versions of both. A signifi

Re: BadZipfile "file is not a zip file"

2009-01-09 Thread Martin v. Löwis
> What would cause a zip file to not have a table of contents? AFAICT, _EndRecData is failing to find the "end of zipfile" structure in the file. You might want debug through it to see where it looks, and how it decides that this structure is not present in the file. Towards 22 bytes before the en

Re: Replying to list messages

2009-01-09 Thread Steven D'Aprano
On Thu, 08 Jan 2009 10:42:13 -0800, Paul McNett wrote: > Ben Finney wrote: >> Paul McNett writes: >>> But arguing about this here isn't going to change anything: opinions >>> differ just like tabs/spaces and bottom-post/top-post. >> >> In cases like this, one side can simply be wrong :-) >> >>

Re: BadZipfile "file is not a zip file"

2009-01-09 Thread Carl Banks
On Jan 9, 2:16 am, Steven D'Aprano wrote: > On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote: > > The error... > ... > > BadZipfile: File is not a zip file > > > When I look at data.zip in Windows, it appears to be a valid zip file. > > I am able to uncompress it in Windows XP, and can also uncom

Re: drive a desktop app from python?

2009-01-09 Thread James Stroud
Tim Arnold wrote: Hi, I don't even know what to google for on this one. I need to drive a commercial desktop app (on windows xp) since the app doesn't have a batch interface. It's intended to analyze one file at a time and display a report. I can get the thing to write out the report an html

Re: Best practice in organize classes into modules

2009-01-09 Thread Bruno Desthuilliers
Steven Woody a écrit : On Fri, Jan 9, 2009 at 1:02 PM, James Mills wrote: On Fri, Jan 9, 2009 at 2:57 PM, Steven Woody wrote: In C++/Java, people usually put one class into one file. What's the suggestion on this topic in Python? I so much interesting this especially when exception classes

Re: Best practice in organize classes into modules

2009-01-09 Thread Steven Woody
On Fri, Jan 9, 2009 at 4:54 PM, Bruno Desthuilliers wrote: > Steven Woody a écrit : >> >> On Fri, Jan 9, 2009 at 1:02 PM, James Mills >> wrote: >>> >>> On Fri, Jan 9, 2009 at 2:57 PM, Steven Woody >>> wrote: In C++/Java, people usually put one class into one file. What's the sugg

Re: Implementing file reading in C/Python

2009-01-09 Thread Marc 'BlackJack' Rintsch
On Fri, 09 Jan 2009 04:04:41 +0100, Johannes Bauer wrote: > I've first tried Python. Please don't beat me, it's slow as hell and > probably a horrible solution: > > #!/usr/bin/python > import sys > import os > > f = open(sys.argv[1], "r") Mode should be 'rb'. > filesize = os.stat(sys.argv[1])[

Re: Default __nonzero__ impl doesn't throw a TypeError exception

2009-01-09 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : Sergey Kishchenko a écrit : (snip) #prints "Ouch!" f=Foo() if f: print "Ouch!" So, default __nonzero__ impl is to return True. Yes. It's clearly documented FWIW. To be more exact: there's no "default __nonzero__". The boolean value of an object is eval'd

Re: Python 2.6 fails on compiling > Bug report

2009-01-09 Thread googler . 1 . webmaster
hm... any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 fails on compiling > Bug report

2009-01-09 Thread David Cournapeau
On Fri, Jan 9, 2009 at 6:18 PM, wrote: > hm... any ideas? Posting the config.log file would be a first step to give more information, David -- http://mail.python.org/mailman/listinfo/python-list

Re: Implementing file reading in C/Python

2009-01-09 Thread James Mills
On Fri, Jan 9, 2009 at 7:15 PM, Marc 'BlackJack' Rintsch wrote: >> print("Filesize : %d" % (filesize)) print("Image size : %dx%d" >> % (width, height)) print("Bytes per Pixel: %d" % (blocksize)) > > Why parentheses around ``print``\s "argument"? In Python <3 ``print`` is > a statement a

Re: BadZipfile "file is not a zip file"

2009-01-09 Thread John Machin
On Jan 9, 7:16 pm, Steven D'Aprano wrote: > On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote: > > The error... > ... > > BadZipfile: File is not a zip file > > > When I look at data.zip in Windows, it appears to be a valid zip file. > > I am able to uncompress it in Windows XP, and can also uncom

Re: drive a desktop app from python?

2009-01-09 Thread Ant
On Jan 8, 9:06 pm, "Tim Arnold" wrote: > Is there any lib or recipe(s) for doing something like this via python? Look into the PyWin32 extension module. It gives access to Windows internals including the COM interface. You'll need to do some research into how to automate the GUI you're using from

Re: Implementing file reading in C/Python

2009-01-09 Thread Marc 'BlackJack' Rintsch
On Fri, 09 Jan 2009 19:33:53 +1000, James Mills wrote: > On Fri, Jan 9, 2009 at 7:15 PM, Marc 'BlackJack' Rintsch > wrote: >> Why parentheses around ``print``\s "argument"? In Python <3 ``print`` >> is a statement and not a function. > > Not true as of 2.6+ and 3.0+ > > print is now a functio

Re: Implementing file reading in C/Python

2009-01-09 Thread James Mills
On Fri, Jan 9, 2009 at 7:41 PM, Marc 'BlackJack' Rintsch wrote: > Please read again what I wrote. Lol I thought "<3" was a smiley! :) Sorry! cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Implementing file reading in C/Python

2009-01-09 Thread Marc 'BlackJack' Rintsch
On Fri, 09 Jan 2009 04:04:41 +0100, Johannes Bauer wrote: > datamap = { } > for i in range(len(data)): > datamap[ord(data[i])] = datamap.get(data[i], 0) + 1 Here is an error by the way: You call `ord()` just on the left side of the ``=``, so all keys in the dictionary

Re: why cannot assign to function call

2009-01-09 Thread Steven D'Aprano
On Thu, 08 Jan 2009 18:33:50 +, Mark Wooding wrote: > [Steven's message hasn't reached my server, so I'll reply to it here. > Sorry if this is confusing.] > > Aaron Brady wrote: >> On Jan 8, 1:45 am, Steven D'Aprano >> wrote: >> > On Wed, 07 Jan 2009 10:17:55 +, Mark Wooding wrote: >> >

Re: BadZipfile "file is not a zip file"

2009-01-09 Thread Steven D'Aprano
On Fri, 09 Jan 2009 00:46:27 -0800, Carl Banks wrote: > On Jan 9, 2:16 am, Steven D'Aprano cybersource.com.au> wrote: >> On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote: >> > The error... >> ... >> > BadZipfile: File is not a zip file >> >> > When I look at data.zip in Windows, it appears to be

Fatal Python error: ceval: tstate mix-up

2009-01-09 Thread Laszlo Nagy
After upgrading my system, a program started to throw this error, and make a core dump: Fatal Python error: ceval: tstate mix-up Kernel log says: Jan 9 05:06:49 shopzeus kernel: pid 89184 (python), uid 1024: exited on signal 6 (core dumped) I found out that this can happen only when execu

Re: Implementing file reading in C/Python

2009-01-09 Thread Steven D'Aprano
On Fri, 09 Jan 2009 19:33:53 +1000, James Mills wrote: > On Fri, Jan 9, 2009 at 7:15 PM, Marc 'BlackJack' Rintsch > wrote: >>> print("Filesize : %d" % (filesize)) print("Image size : >>> %dx%d" % (width, height)) print("Bytes per Pixel: %d" % (blocksize)) >> >> Why parentheses around ``

Re: Implementing file reading in C/Python

2009-01-09 Thread Steven D'Aprano
On Fri, 09 Jan 2009 09:15:20 +, Marc 'BlackJack' Rintsch wrote: >> picture = { } >> havepixels = 0 >> while True: >> data = f.read(blocksize) >> if len(data) <= 0: break > > if data: > break > > is enough. You've reversed the sense of the test. The OP exits the loop w

Re: Encrypted Logging in python

2009-01-09 Thread Steven D'Aprano
On Fri, 09 Jan 2009 00:21:09 -0800, koranthala wrote: > I was wondering if there is a mechanism to encrypt logging automatically > in python. >The issue is as follows: > (a) An application (after py2exe) will go as executable and there > is no need for the user to know that it is written i

Re: Implementing file reading in C/Python

2009-01-09 Thread Marc 'BlackJack' Rintsch
On Fri, 09 Jan 2009 04:04:41 +0100, Johannes Bauer wrote: > As this was horribly slow (20 Minutes for a 2GB file) I coded the whole > thing in C also: Yours took ~37 minutes for 2 GiB here. This "just" ~15 minutes: #!/usr/bin/env python from __future__ import division, with_statement import os

Re: Best practice in organize classes into modules

2009-01-09 Thread Bruno Desthuilliers
Steven Woody a écrit : On Fri, Jan 9, 2009 at 4:54 PM, Bruno Desthuilliers wrote: Steven Woody a écrit : On Fri, Jan 9, 2009 at 1:02 PM, James Mills wrote: On Fri, Jan 9, 2009 at 2:57 PM, Steven Woody wrote: In C++/Java, people usually put one class into one file. What's the suggestion on

Re: Implementing file reading in C/Python

2009-01-09 Thread Steve Holden
Marc 'BlackJack' Rintsch wrote: > On Fri, 09 Jan 2009 04:04:41 +0100, Johannes Bauer wrote: [...] >> print("Filesize : %d" % (filesize)) print("Image size : %dx%d" >> % (width, height)) print("Bytes per Pixel: %d" % (blocksize)) > > Why parentheses around ``print``\s "argument"? In Pyth

Re: BadZipfile "file is not a zip file"

2009-01-09 Thread John Machin
On Jan 9, 7:46 pm, Carl Banks wrote: > On Jan 9, 2:16 am, Steven D'Aprano > > > > > cybersource.com.au> wrote: > > On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote: > > > The error... > > ... > > > BadZipfile: File is not a zip file > > > > When I look at data.zip in Windows, it appears to be a

Re: Implementing file reading in C/Python

2009-01-09 Thread Steve Holden
Steven D'Aprano wrote: > On Fri, 09 Jan 2009 19:33:53 +1000, James Mills wrote: > >> On Fri, Jan 9, 2009 at 7:15 PM, Marc 'BlackJack' Rintsch >> wrote: print("Filesize : %d" % (filesize)) print("Image size : %dx%d" % (width, height)) print("Bytes per Pixel: %d" % (blocksize))

Line completion with custom commands

2009-01-09 Thread gu
Hi, my Python program can be launched with a range of different options (or subcommands) like: $ myProgram doSomething $ myProgram doSomethingElse $ myProgram nowDoSomethingDifferent I want it to use auto-completion with so that if i type "myProgram d" it returns "myProgram doSomething" and

Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-09 Thread Luke Kenneth Casson Leighton
On Thu, Jan 8, 2009 at 9:07 PM, "Martin v. Löwis" wrote: >> i'd just ... much rather be completely independent of proprietary >> software when it comes to building free software. > > I guess my question is then: why do you want to use Windows in the > first place? ha ha :) the same question wa

Re: Implementing file reading in C/Python

2009-01-09 Thread mk
Johannes Bauer wrote: Which takes about 40 seconds. I want the niceness of Python but a little more speed than I'm getting (I'd settle for factor 2 or 3 slower, but factor 30 is just too much). This probably doesn't contribute much, but have you tried using Python profiler? You might have *so

Re: Line completion with custom commands

2009-01-09 Thread Steve Holden
gu wrote: > > Hi, my Python program can be launched with a range of different options > (or subcommands) like: > > $ myProgram doSomething > $ myProgram doSomethingElse > $ myProgram nowDoSomethingDifferent > > I want it to use auto-completion with so that if i type "myProgram d" it > returns "m

Re: figuring week of the day....

2009-01-09 Thread Tim Chase
Tim Chase wrote: tekion wrote: Is there a module where you could figure week of the day, like where it starts and end. I need to do this for a whole year. Thanks. the monthcalendar() call returns the whole month's calendar which may be more what you want for the big-picture. And if you want

Re: Line completion with custom commands

2009-01-09 Thread gu
Steve Holden wrote: gu wrote: Hi, my Python program can be launched with a range of different options (or subcommands) like: $ myProgram doSomething $ myProgram doSomethingElse $ myProgram nowDoSomethingDifferent I want it to use auto-completion with so that if i type "myProgram d" it returns

Re: Line completion with custom commands

2009-01-09 Thread Marco Mariani
gu wrote: I see, but how does django-admin work, then? from bash: complete -W "doSomething doSomethingElse doSomethingDifferent" myProgram -- http://mail.python.org/mailman/listinfo/python-list

Re: why cannot assign to function call

2009-01-09 Thread Aaron Brady
On Jan 9, 4:01 am, Steven D'Aprano wrote: > On Thu, 08 Jan 2009 18:33:50 +, Mark Wooding wrote: > > [Steven's message hasn't reached my server, so I'll reply to it here. > > Sorry if this is confusing.] > > > Aaron Brady wrote: > >> On Jan 8, 1:45 am, Steven D'Aprano > >> wrote: > >> > On We

Re: Line completion with custom commands

2009-01-09 Thread Steve Holden
gu wrote: > Steve Holden wrote: >> gu wrote: >>> Hi, my Python program can be launched with a range of different options >>> (or subcommands) like: >>> >>> $ myProgram doSomething >>> $ myProgram doSomethingElse >>> $ myProgram nowDoSomethingDifferent >>> >>> I want it to use auto-completion with s

Re: Line completion with custom commands

2009-01-09 Thread gu
Marco Mariani wrote: gu wrote: I see, but how does django-admin work, then? from bash: complete -W "doSomething doSomethingElse doSomethingDifferent" myProgram This worked like a charm, thank you so much. Is this available for bash only or any shell? -- http://mail.python.org/mailman/lis

Re: [Help] The pywinauto Can't select the MDI's menu using the MenuItems() which return [].

2009-01-09 Thread Korobase
2008/12/22 Simon Brunning > 2008/12/21 : > > The code below opens the Choose Font dialog on my Spanish Windows > version: > > > > py> from pywinauto.application import Application > > py> app = Application.start("Notepad.exe") > > Notepad's menus are build with MFC. Word's menus are not. Trust m

Re: drive a desktop app from python?

2009-01-09 Thread zugn...@gmail.com
> Is there any lib or recipe(s) for doing something like this via python? > I've used pywinauto to do something similar, and found it good. http://pywinauto.openqa.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Unexpected scientific notation

2009-01-09 Thread Mark Dickinson
On Jan 8, 1:00 am, Paul McNett wrote: > It displays '3E+1' instead of '30.0'. > > As I can't reproduce I'm looking for an idea brainstorm of what could be > causing > this. What would be choosing to display such a normal number in scientific > notation? > > Ideas? [I thought I replied to this e

Re: Fatal Python error: ceval: tstate mix-up

2009-01-09 Thread Laszlo Nagy
I could start "gdb python python.core" but don't know what it means. Unfortunately, there are no debugging symbols. %gdb /usr/local/bin/python python.core GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and yo

pySerial - accessing GSM module failed

2009-01-09 Thread Dave Dave
Hello all, I'm newbie in the serial buissness and I beed some Help. I'm a student at my last year and I got final assaignment. My goal is to comunicate with SIM free, GSM Module through computer. I want to simulate SIM card by receiving and transferring data from my code. In order to understand ho

Re: Implementing file reading in C/Python

2009-01-09 Thread Johannes Bauer
Marc 'BlackJack' Rintsch schrieb: >> f = open(sys.argv[1], "r") > > Mode should be 'rb'. Check. >> filesize = os.stat(sys.argv[1])[6] > > `os.path.getsize()` is a little bit more readable. Check. >> print("Filesize : %d" % (filesize)) print("Image size : %dx%d" >> % (width, height)

Re: Implementing file reading in C/Python

2009-01-09 Thread Johannes Bauer
James Mills schrieb: > What does this little tool do anyway ? > It's very interesting the images it creates > out of files. What is this called ? It has no particular name. I was toying around with the Princeton Cold Boot Attack (http://citp.princeton.edu/memory/). In particular I was interested

Re: Implementing file reading in C/Python

2009-01-09 Thread Johannes Bauer
Marc 'BlackJack' Rintsch schrieb: > On Fri, 09 Jan 2009 04:04:41 +0100, Johannes Bauer wrote: > >> As this was horribly slow (20 Minutes for a 2GB file) I coded the whole >> thing in C also: > > Yours took ~37 minutes for 2 GiB here. This "just" ~15 minutes: Ah, ok... when implementing your sug

Re: Implementing file reading in C/Python

2009-01-09 Thread Johannes Bauer
mk schrieb: > Johannes Bauer wrote: > >> Which takes about 40 seconds. I want the niceness of Python but a little >> more speed than I'm getting (I'd settle for factor 2 or 3 slower, but >> factor 30 is just too much). > > This probably doesn't contribute much, but have you tried using Python > p

Re: Force exception on attribute write access only one object

2009-01-09 Thread Thomas Guettler
Hi Peter and others, your idea was good, but it does not work with Django ORM Models: Traceback (most recent call last): File "/localhome/modw/django/core/handlers/base.py", line 87, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/localhome/modw/foo/

Re: Encrypted Logging in python

2009-01-09 Thread koranthala
On Jan 9, 3:16 pm, Steven D'Aprano wrote: > On Fri, 09 Jan 2009 00:21:09 -0800, koranthala wrote: > > I was wondering if there is a mechanism to encrypt logging automatically > > in python. > >    The issue is as follows: > >     (a) An application (after py2exe) will go as executable and there >

Re: Fatal Python error: ceval: tstate mix-up

2009-01-09 Thread Laszlo Nagy
Meanwhile I'm trying to turn off threads in that program one by one. I just got this new type of error: Fatal Python error: PyThreadState_Delete: invalid tstate -- http://mail.python.org/mailman/listinfo/python-list

win32gui

2009-01-09 Thread Gandalf
Hi, everyone I'm searching the win32gui lib to find a way to get the text under the user cursor. so far I managed to find only the controller ID which under the cursor this way cursorID = win32gui.WindowFromPoint(win32gui.GetCursorPos()) their is function called GetWindowText I tried to use but i

Re: win32gui

2009-01-09 Thread TheSeeker
On Jan 9, 7:34 am, Gandalf wrote: > Hi, everyone > I'm searching the win32gui lib to find a way to get the text under the > user cursor. > so far I managed to find only the controller ID which under the cursor > this way > > cursorID = win32gui.WindowFromPoint(win32gui.GetCursorPos()) > > their is

Re: Encrypted Logging in python

2009-01-09 Thread pruebauno
On Jan 9, 8:02 am, koranth...@gmail.com wrote: > Also, what I am asking is a generic option in logging - which can help > the adoption of the logging framework in even closed source systems. > It is not just about security - just that a closed source company > might be much more comfortable in usin

Python Apache Handler

2009-01-09 Thread Scooter
Does anyone have any good examples, or links thereto for using python as an Apache handler? And I should qualify all of this by saying I'm a python newbie, and while having experience with Apache, I've never done anything outside whats "in the box" . What I'm looking for is how one might use Pytho

Re: Python Imaging Library and textmate

2009-01-09 Thread Philip Semanchuk
On Jan 9, 2009, at 2:49 AM, bilgin arslan wrote: Hello, I am a beginner in python and I am trying to create image files that contain lines from a text file. I am trying to do this with PIL, which seems like a suitable tool. I have a copy of TextMate(1.5.8) and I run Macosx 10.5.6 The pro

  1   2   3   >