[Tutor] [tutor] how to cast to stucture

2006-09-04 Thread emilia12
Hi list, i have a complex data in binary file and i want to read its fields... the C way is to read file in buffer and then cast it to proper structure. Is there a way to do the same in Python or i have to read the data byte by byte ? Regards, E. - Спортни залагани

Re: [Tutor] File open error

2006-09-04 Thread Danny Yoo
On Tue, 5 Sep 2006, John Fouhy wrote: >> When i'm executing it i get this error (runtime) >> >> Traceback (most recent call last): >> File "C:\python\boa\backup\backupwin.py", line 135, in OnStartaButton >>config = open("backup.conf", "r") >> TypeError: an integer is required I agree with

Re: [Tutor] File open error

2006-09-04 Thread John Fouhy
On 05/09/06, Magnus Wirström <[EMAIL PROTECTED]> wrote: > When i'm executing it i get this error (runtime) > > Traceback (most recent call last): > File "C:\python\boa\backup\backupwin.py", line 135, in OnStartaButton >config = open("backup.conf", "r") > TypeError: an integer is required Look

[Tutor] File open error

2006-09-04 Thread Magnus Wirström
Hi I'm trying to open a file with open() but i get this error i cant put my finger how to fix. Code looks like this. ... def OnStartaButton(self, event): print "Startade ", ctime(time()) self.startOP.SetLabel(ctime(time())) self.staticText7.SetLabel("Läser konfigur

Re: [Tutor] making independent program?

2006-09-04 Thread Kay White
Kay White <[EMAIL PROTECTED]> wrote: Andrew Robert <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE-Hash: SHA1Rather than fight this, I recommend you try cx_freeze.Over all, it is much easier to use and does not require codemodification of any kind.http://www.python.net/crew/atuining/

Re: [Tutor] making independent program?

2006-09-04 Thread Kay White
Bill Burns <[EMAIL PROTECTED]> wrote: > I've tried to follow the py2exe wiki instructions on how to trim this > out, http://www.py2exe.org/index.cgi/TkInter, but I seem to be doing > something wrong. Here's my setup.py---> > from distutils.core import setup> import py2exe> > excludes = ["pywin", "

Re: [Tutor] making independent program?

2006-09-04 Thread Kay White
Andrew Robert <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE-Hash: SHA1Rather than fight this, I recommend you try cx_freeze.Over all, it is much easier to use and does not require codemodification of any kind.http://www.python.net/crew/atuining/cx_Freeze/cx_freeze does make a much s

Re: [Tutor] Is this called a 'Hash table method for string mapping'

2006-09-04 Thread Danny Yoo
> So, what if one has to map a string of 15 character nucleotide to a > jumbo string of characters of length in millions. Hi Srinivas, If you're doing research into this, I strongly recommend you take a look at Dan Gusfield's excellent textbook "Algorithms on Strings, Trees, and Sequences":

Re: [Tutor] making independent program?

2006-09-04 Thread Bill Burns
> I've tried to follow the py2exe wiki instructions on how to trim this > out, http://www.py2exe.org/index.cgi/TkInter, but I seem to be doing > something wrong. Here's my setup.py--- > > from distutils.core import setup > import py2exe > > excludes = ["pywin", "pywin.debugger", "pywin.debugg

Re: [Tutor] making independent program?

2006-09-04 Thread Kay White
John Fouhy <[EMAIL PROTECTED]> wrote: On 29/08/06, Alan Gauld wrote:> Thats probably because the most common methods for> producing an exe file are "non-trivial" to use, especially for> newbies.>> Look up py2exe on Google...py2exe is not too hard for simple tasks (unless something goes wrong),esp

Re: [Tutor] Handling function parameters of mixed object and basic types

2006-09-04 Thread Kent Johnson
Duncan Gibson wrote: > I've taken over someone else's code (yes, honestly!) that has a > complex class hierarchy on top of the main procedural code. This > is unfortunate because it means that isinstance() is everywhere. > > Profiling recently highlighted one particular formatted output > function

Re: [Tutor] Handling function parameters of mixed object and basic types

2006-09-04 Thread Duncan Gibson
I wrote: > >def newOutput(x): > >if x is None: > >pass > >return > >try: > >x.output() > >except AttributeError: > >if isinstance(x, int): > >pass > >elif isinstance(x, float): > >

Re: [Tutor] Handling function parameters of mixed object and basic types

2006-09-04 Thread Alan Gauld
> I've taken over someone else's code (yes, honestly!) that has a > complex class hierarchy on top of the main procedural code. This > is unfortunate because it means that isinstance() is everywhere. It shouldn't do. Multiple uses of isinstance is usually a sign of bad OO design, regardlerss of wh

[Tutor] Handling function parameters of mixed object and basic types

2006-09-04 Thread Duncan Gibson
I've taken over someone else's code (yes, honestly!) that has a complex class hierarchy on top of the main procedural code. This is unfortunate because it means that isinstance() is everywhere. Profiling recently highlighted one particular formatted output function that has a cascade of isinstan

Re: [Tutor] Handling hundreds of thousands of inserts with MySQLdb

2006-09-04 Thread Gonzillaaa
Kent I realised after I asked how silly it was to try to "silence" Python. Is just bad habits picked up from php, I fixed the schema and now is all fine. Karl you're absolutely right "LOAD DATA INFILE" works flawlessly and is a lot faster. it seems I was using the wrong tool for the job a