Re: str vs dict API size (was 'Re: left padding zeroes on a string...')

2005-03-25 Thread Larry Bates
Once it is in everyone is hesitant to take it out for fear of breaking someone's code that uses it (no matter how obscure). Putting in new methods should be difficult and require lots of review for that reason and so we don't have language bloat. Larry Bates George Sakkis wrote: >

Re: Dumb*ss newbie Q

2005-03-28 Thread Larry Bates
__str__ method to generate the output from this module). Hope information helps. Larry Bates Captain Dondo wrote: > OK, I know this is covered somewhere in Python 101, but for the life of me > I cannot figure this out. I really need a basic intro to Python book > > I am trying to do

Re: Newbie Printing Question

2005-03-28 Thread Larry Bates
If it is a print that can take direct character output (e.g. one that has PCL or text mode emulation) you can do following: lpr=open('LPT1','w') # or LPT2, LPT3 lpr.writeline('the output line you want') lpr.close() If it is a GDI-only printer it is MUCH more difficult. You need to interface with

Re: Python Cookbook, 2'nd. Edition is published

2005-03-28 Thread Larry Bates
from some of the more advanced examples and found several recipes that I'm sure I'll use in the future. I think this will go on my bookshelf beside Fredrkik Lundh's "Python Standard Library" and Mark Hammond's "Python Programming on Win32" as a resource that I&

Re: Python Cookbook, 2'nd. Edition is published

2005-03-28 Thread Larry Bates
Sorry, I didn't ever have copy of 1st edition. Maybe Alex can help us on this one? -Larry [EMAIL PROTECTED] wrote: > Hello Larry, > > I don't have my copy yet. Can you give any guidance on how the 2'nd > edition compares to the 1'st edition? At 844 pages, it seems to be 250+ > pages bigger than

Re: [Newbie] How do I get better at Python programming?

2005-03-29 Thread Larry Bates
ering very advanced techniques. 3) Read the standard library documentation and source code. You can learn a lot. 4) Read this list every day. I learn something daily. Larry Bates Anon wrote: > I've gotten off to a good start for programming using Python (my first > programming language

Re: urllib.urlretireve problem

2005-03-29 Thread Larry Bates
e to first determine if the URL actually exists. Larry Bates Ritesh Raj Sarraf wrote: > Hello Everybody, > > I've got a small problem with urlretrieve. > Even passing a bad url to urlretrieve doesn't raise an exception. Or does > it? > > If Yes, What exception is it ?

Re: twistedSnmp and hexadecimal values ...

2005-03-30 Thread Larry Bates
You really should give an example so that we will know what you mean by "weird and useless". Otherwise you are asking us to implement TwistedSnmp to see what you are referring to. Larry Bates Francesco Ciocchetti wrote: > Hi all ml. > > I'm tryng to use TwistedSnm

Re: Write an hexadecimal file

2005-03-30 Thread Larry Bates
Python you open the file with "wb" mode. Example: fp=open('myfile.dat', 'wb') fp.write(bytes) fp.close() >From your post I cannot tell anything more about what you are actually doing, so I hope this helps. Larry Bates Cesar Andres Roldan Garcia wrote:

Re: Making a DLL with python?

2005-03-31 Thread Larry Bates
I don't think you can make a .DLL (but someone else might). Why can't you use a COM server? MS seems to have written some pretty sophisticated software using COM objects. Almost all languages can dispatch a COM object easily. -Larry [EMAIL PROTECTED] wrote: > Can I use python to make a regular

Re: Unzipping Files

2005-04-01 Thread Larry Bates
Use something like: import zipfile zfile=zipfile.ZipFile(zipfilename,'r') contents=zfile.read(filenametoread) Stripped out of a working program, but not tested. -Larry Bates Greg Lindstrom wrote: > Hello- > I am trying to read a file from a zip archive. I have read the &g

Re: Insert database rows from CSV file

2005-04-04 Thread Larry Bates
You may want to take a look at this link. It should be much faster than any programmatic technique. http://www.its.niu.edu/its/CSupport/tipoftheweek/tip_080502.shtml If you still want to do it programmatically, you will need to look at csv module to parse the lines. Larry Bates 3c273 wrote

Re: copying a file in the python script

2005-04-05 Thread Larry Bates
nlink). Larry Bates Raghul wrote: > hi >I am having a problem. I want to copy a file from the folder and > paste it or move it to another folder. Is it possible in python? > Actually I need to implement this in the zope for my site. When I click > any file it should move or copied

Re: Python IDE like NetBeans/Delphi IDE

2005-04-05 Thread Larry Bates
Take a look at ActiveState: http://www.activestate.com/Products/ActivePythonFamily/?_x=1 or for something more general: http://www.eclipse.org/ Larry Bates [EMAIL PROTECTED] wrote: > Hi ! > > I search for an IDE that working in Windows, and knows these functions: > > A.)

Re: How to detect windows shutdown

2005-04-06 Thread Larry Bates
Win32 (Hammond and Robinson) and use Mark Hammonds Python Windows extension library. Larry Bates Austin wrote: > I wrote a program running on windows. > I put the link of the program in "Start up" folder and let it executed > minimized. > Every time when I open the comput

Re: struct enhancements?

2005-04-07 Thread Larry Bates
Can't address the 8-byte longs, but to strip off null padding in strings you merely do s=s.rstrip('\x00') Larry Bates [EMAIL PROTECTED] wrote: > Hi everyone, > > I would like to be able to pack/unpack 8-byte longs, and have strings > with null padding to be able to

Re: Document exchange!

2005-04-11 Thread Larry Bates
ation with annual subscriptions. Larry Bates James wrote: > This is not so much as a Python question though I will implement it in > it. > > I am looking to securely aggregate documents based on a metadata from > multiple providers. I am getting the feeling that I am reinventing th

Re: Avoiding DOS Window...

2005-04-11 Thread Larry Bates
, bInheritHandles, dwCreationFlags, newEnvironment, currentDirectory, STARTUPINFO) Larry Bates [EMAIL PROTECTED] wrote: > Hello NG, > > I don'

Re: My stupid newbie mistake

2005-04-11 Thread Larry Bates
Because Python allows you to replace built-in methods with your own. Later you will find that this can be extremely powerful. You will stumble on this if you name a list 'list' a string 'str', integer 'int', float 'float', dictionary 'dict', ..

Re: terminate exectutioin in PythonWin

2005-04-13 Thread Larry Bates
1) To exit any application: import sys sys.exit(0) 2) I'm not familiar with any of these development systems. I use what comes with ActiveState's PythonWin. It does have debugging breakpoints, etc. Larry Bates Jim wrote: > Hi all > > 1.Could someone tell me how to ter

Re: Get the entire file in a variable - error

2005-04-14 Thread Larry Bates
quit. When you open with "b" mode it reads the number of bytes that the filesytem has stored for the file. Hope info helps. Larry Bates [EMAIL PROTECTED] wrote: > H! > > I'm using a database and now I want to compress a file and put it into > the database. > &

Re: distribute python script

2005-04-14 Thread Larry Bates
py2exe works just fine, but you didn't give enough information for us to help you. Thomas Heller (maintainer of py2exe) monitors this list. So post some more information of what "...caused a problem in my script..." means and we will all try to help. Larry Bates codecraig wro

Re: accesing pages (or ranges of pages) via Reportlab

2005-04-18 Thread Larry Bates
ReportLab doesn't support this in the free version but they sell an add-on called PageCatcher that has this feature. I've used it on a couple of projects and it works EXTREMELY well. -Larry Rajarshi Guha wrote: > Hi, I've been using pdflatex to dump ranges of pages from a PDF file via > Python.

Re: (PHP or Python) Developing something like www.tribe.net

2005-04-18 Thread Larry Bates
Zope3 experience. Plone's CMF is going to be very hard to beat. -Larry Bates Mir Nazim wrote: > Hi there. > > I am about to undertake a project. My employer wants it to be developed > in PHP. While I was thinking that Python will be better for this job. > > The project will

Re: [Python-Dev] How do you get yesterday from a time object

2005-04-19 Thread Larry Bates
nvert using time.localtime after. For future reference: Please post a copy of your traceback instead of just saying "<-- generates and error". It helps people to respond more quickly and accurately. -Larry Bates Simon Brunning wrote: > On 4/19/05, Ralph Hilton <[EMAIL PROTE

Re: Resolving 10060, 'Operation timed out'

2005-04-20 Thread Larry Bates
nt to s.setblocking(1). New in version 2.3. -Larry Bates willitfw wrote: > Does anyone know how to prevent this error from occurring: IOError: > [Errno socket error] (10060, 'Operation timed out'). > > I am using the following code without any luck. Obviously I am missing >

Re: How can I verify that a passed argument is an interible collection?

2005-04-21 Thread Larry Bates
(more general solution) if hasattr(arg, 'next') and not hasattr(arg, '__iter__'): # perform work on iterable else: print "arg must be an iterable" Larry Bates Charles Krug wrote: > List: > > I'm working on some methods that operate on (math

Re: Changing a line in a text file

2005-04-25 Thread Larry Bates
fp=open(filename, 'w') fp.write(newcontents) fp.close() For small files this is very efficient. Larry Bates kah wrote: > How do I change a line in a file?? > > For example I have the follwing text in my file: > > line1 > line2 > line3 > line4 > > How do I

Re: How to exctract title of links

2005-04-26 Thread Larry Bates
You should take a look at BeautifulSoup at: http://www.python.org/pypi/BeautifulSoup/2.0.2 Larry Bates raver2046 wrote: > here i have a link http://raver2046.ath.cx/CV/";>cv network > admin > > how to extract "cv network admin" > > > here is the co

Re: interactive web graphics

2005-04-27 Thread Larry Bates
. The ReportLab graphics can do barcharts, line charts, scatter plots, etc. and you can either save as .JPG files that can be delivered on a web page or as a .PDF file that the user can download. Hard to say which would work best for you. Hope information helps a little. -Larry Bates Eckhoff, Mich

Re: Question about python code distribution...

2005-04-28 Thread Larry Bates
mpler. -Larry Bates [EMAIL PROTECTED] wrote: > Hi, > > I am sure that this question might have come up repeatedly. Companies > may not want to distribute their python code in source form. Even > though pyc files are one option, it gets inconvenient to distribute > bunch of them

Re: Data smoothing algorithms?

2005-04-29 Thread Larry Bates
/scipy.interpolate.html http://cmp.felk.cvut.cz/~kybic/thesis/pydoc/bigsplines.html http://www.mirror5.com/software/plotutils/plotutils.html Good Luck Larry Bates John J. Lee wrote: > "Anthra Norell" <[EMAIL PROTECTED]> writes: > > >>Hi, >> >>The following are differences

Re: binascii.crc32 results not matching

2005-12-11 Thread Larry Bates
Thanks so much for the offer, I had a friend do this for me and it works great. Regards, Larry Bates Heiko Wundram wrote: > Larry Bates wrote: > >> >> >>The algorithm looks very much like the source code for >>binascii.crc32 (but I'm not a C programmer). &g

Re: Help: how to run python applications as NT service?

2005-12-12 Thread Larry Bates
r of milliseconds before running a second time. The example just waits for a stop signal. Here is a skeleton of a service that should get you started. I HIGHLY recommend spending the money to purchase the book (Python Programming on WIN32). There are more extensive examples than the one you have tha

Re: IsString

2005-12-12 Thread Larry Bates
ple)) False >>> The old way was to use type(a), but I think isinstance is the new "preferred" method. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing a python script with arguments from a python script

2005-12-12 Thread Larry Bates
You can pass arguments into a python script, see getopt module. Then to call an external script you would use subsystem module (or os.system if you are on earlier version of python). If you can, just make the other python program into a function and import it as James Stroud suggests in a separate

Re: IsString

2005-12-12 Thread Larry Bates
, but reread the post. He asks "if a given variable is a character or a number". I figured that even if he is coming from another language he knows the difference between "a given variable" and the "contents of a give variable". I guess we will see ;-). This list is so good, he gets BOTH questions answered. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Worthwhile to reverse a dictionary

2005-12-15 Thread Larry Bates
be stored as binary integers in ASCII (e.g. 'a' = 65, 'b'=66, etc.). You can go the other direction with chr(x). Not completely sure about what you want to accomplish, but this eliminates the need for the dictionaries. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about tuple lengths

2005-12-15 Thread Larry Bates
uot;blah" without the comma of > length four? Is there a good reason for this or is this a bug? Additional note: You should not give a tuple a variable name of tuple, it masks the built-in tuple() function. This also goes for str, or other built-ins. This will "bite" you at some point if it hasn't already. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuples

2005-12-15 Thread Larry Bates
work? Thanks for the help! > Works just fine for me. Suggestion: You should ALWAYS post your traceback instead of just saying "Why won't this work?". Your subject says "Tuples" then your example is on lists. Were you trying something like this on tuples

Re: Problem with exec

2005-12-16 Thread Larry Bates
iables and it > contains a 'config' entry, so why doesn't this work? > Not entirely sure why you want to do what you have outlined here but this works: class Cfg: pass #config = Cfg() def assign(config): setattr(config, 'Start' , [13, 26, 29, 34]) def foo(): config = Cfg() assign(config) print config.Start foo() You should probably post what you are trying to do. Maybe we can make a suggestion about the best approach. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Browse type function

2005-12-16 Thread Larry Bates
Google is your friend: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438123 -Larry Bates Tuvas wrote: > I am building a GUI interface with Tkinter. I need to have a way to > open and save files. Is there a nice GUI that can do that for me, ei, > show what files are avaliable,

Re: attach a pdf file to an email

2005-12-19 Thread Larry Bates
own, it should help as a guide. http://motion.sourceforge.net/related/send_jpg.py Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: RasAdminUserGetInfo

2005-12-19 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Anyone got any idea how to use this? It looks like it isn't available > directly from the win32 extensions. > > Thanks, MW. > Google is your friend: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/rasadminusergetin

Re: RasAdminUserGetInfo

2005-12-20 Thread Larry Bates
o I'm a little stumped on where the road > goes from here..MW. > Sorry, I misread your initial post. You should be able to use ctypes to call the function or perhaps you can dispatch it manually. I'm not that familiar with the function. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing engineering symbols

2005-12-20 Thread Larry Bates
Something like: def cvt(input): if input.lower().endswith('k'): return float(input[:-1])*1000 . . add your other special symbols here . return None # didn't find a match Larry Bates Suresh Jeevanandam wrote: > Hi, > I want to convert a strin

Re: checking if a string contains a number

2005-12-20 Thread Larry Bates
You should probably work through the tutorials. Use a try block: try: x=float(s) except ValueError: print 'Non-numeric value %s found' % s -Larry Bates Suresh Jeevanandam wrote: > Hi, > I have a string like, > s1 = '12e3' > s2 = 'junk&

Re: Newbie: adding string values to a list?

2005-12-21 Thread Larry Bates
e advice on what I'm doing wrong? > > Many thanks and much warmth, > > planetthoughtful > You want to 'append' the string to the list. extend is used to combine two lists. Since your string isn't a list Python tries to help and converts it to one for you. That's why you get the individual letters. > result.append(name) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: A simple list question.

2005-12-22 Thread Larry Bates
erent things in one if statement and it is unclear where self.currentSlice comes from. You also need a condition on your elif. Perhaps more explanation is needed (at least for me to help). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentation/whitespace

2005-12-23 Thread Larry Bates
Joe wrote: > Is Python going to support s syntax the does not use it's infamous > whitespace rules? I recall reading that Python might include such a > feature. Or, maybe just a brace-to-indentation preprocessor would be > sufficient. > > Many people think Python's syntax makes sense. There are st

Re: Python as a Server vs Running Under Apache

2005-12-30 Thread Larry Bates
ke XMPRPC, DAV, FTP, that can take quite a lot of time to implement from scratch. It may not be for you, but you owe it to yourself to take a look. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: query on python list

2005-12-30 Thread Larry Bates
3 If you want to know if list2 is found in list 1 it is as simple as: if list2 in list1: # # Do something here # if you want to know if any member of list2 is found in any list in list 1 then you can just do: Found=max([y in x for y in list2 for x in list1]) works and you should h

Re: oop in python

2005-12-30 Thread Larry Bates
to refer to it by a name. The best way to do this is to put the class instance in a dictionary and make the key 'new' instancedict={} instancedict['new']=Point() then you can call methods by: instancedict['new'].somemethod() -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple clients updating same file in ftp

2006-01-10 Thread Larry Bates
Preface the update with a rename. If the rename fails, someone else is updating the file, if it succeeds update the file and rename back when finished. Suggestion: ftp is not the best way to handle such a task. Use a database, XMLRPC or sockets is probably a better way. -Larry Bates [EMAIL

Re: copying a file from windows file system to ext2 and ext3

2006-01-10 Thread Larry Bates
[EMAIL PROTECTED] wrote: > hi all > > could anybody please tell me how can i copy a file from windows file > systems like FAT12, FAT16,FAT32 and NTFS to EXT2, and EXT3. > Is their any function in python that we can do the above > > Thanks in advance > Yogi > I suspect that you are going to need

Re: batch tiff to jpeg conversion script

2006-01-11 Thread Larry Bates
n(root,f)) print "Generating jpeg for %s" % f im.thumbnail(im.size) im.save(jpgpath, "JPEG", quality=100) except Exception, e: print e continue print "A jpeg file already exists for %s" % f This code: 1) only processess .tif files 2) simplifies things by eliminating the splitext methods and slicing operations. 3) eliminates else branch -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: problem of types:

2006-01-17 Thread Larry Bates
--- > > Changing 'list' to 'type(list)' don't change anything > Your string variable type is masking the built-in type function. You should avoid variables with names like type, list, str, tuple, ... (e.g. built-ins). As they will mask the built-ins from your program. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser: writes a list but reads a string?

2006-01-17 Thread Larry Bates
> print statements. > > Is there a pythonic way to read in a list from a .INI file with > ConfigParser? Is this expected behavior for ConfigParser? I would > not expect this conversion; rather, an exception when trying to write > the list if the list is not supported. > To read lists from .INI files I use following: listvalues=INI.get(section, option).split(',') where INI is an instance of ConfigParser There is the problem of if list items contain commas. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Progress Bars in python

2006-07-12 Thread Larry Bates
he script > is processing...? > > > Hari This also is shown in Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207 Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Python linker

2006-07-19 Thread Larry Bates
Don't use wx, use native Windows controls that already exist on the machine. That makes the application very small. That said, I disagree that 3.5Mb is too much to download. It only takes about 7 seconds on my machine (cable modem). If your users won't wait that long, they weren't very interest

Re: using names before they're defined

2006-07-19 Thread Larry Bates
What about something like: supply = supply() compressor = compressor(supply) combuster = combuster(compressor) compressor.append(combuster) turbine = turbine(combuster) combuster.append(turbine) -Larry Bates [EMAIL PROTECTED] wrote: > I have a problem. I'm writing a simulation progra

Re: Help Needed. Removing a Folder Problem

2006-07-20 Thread Larry Bates
cess module and use something like (not tested): retcode = call([r' C:\copiedfiles\*.*', cmd_out]) This will wait for execution of to complete prior to returning. -Larry Bates Kilicaslan Fatih wrote: > When I push a button to trigger the code: > > def runCC

Re: Checking File permissions

2006-07-20 Thread Larry Bates
.S_IWRITE) Larry Bates Anoop wrote: > Hi All > > Please tell me how to check the existence of a file and the read > permission to the file using python script > > Thanks for ur inputs > > Anoop > -- http://mail.python.org/mailman/listinfo/python-list

Re: using names before they're defined

2006-07-20 Thread Larry Bates
ppend/extend it. IMHO it makes what is going on intuitively obvious. -Larry Bates [EMAIL PROTECTED] wrote: > Bruno, > > Thanks. An issue is that I need to be able to link multiple objects to > a single object etc. > Say for example using the previous wording, I might have com

Re: Language Design: list_for scope?

2006-07-21 Thread Larry Bates
>>> d={1:'x',2:'thing',3:'thing',4:'thing',5:'thing', \ 6:'z',7:'thing',8:'thing',9:'y'} >>> [x for x in d if d[x]=="thing"] [2, 3, 4, 5, 7, 8] -Larry Bates guthrie wrote: >

Re: Finding the name of a class

2006-08-01 Thread Larry Bates
e sake of practice, and am trying to > print the name of the class that a traced method belongs to. This seems > like it should be easy, but I think I've been staring at the problem too > long. print print b.__class__.__name__ gives what you want -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the name of a class

2006-08-01 Thread Larry Bates
Dennis Lee Bieber wrote: > On Tue, 01 Aug 2006 10:56:52 -0500, Kirk Strauser <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Larry Bates wrote: >> >>> print print b.__class__.__name__ gives what you want >> That doesn'

Re: Simple HTML display of a select query

2006-08-02 Thread Larry Bates
[2]) print " Now the fun comes when you wish to embellish this with font sizes, colors, background colors, then the frameworks come in really handy. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Hiding Console Output

2006-08-02 Thread Larry Bates
Kkaa wrote: > I'm using the os.system command in a python script on Windows to run a > batch file like this: > > os.system('x.exe') > > The third-party program x.exe outputs some text to the console that I > want to prevent from being displayed. Is there a way to prevent the > output of x.exe fr

Re: OS independent files

2006-08-03 Thread Larry Bates
info from the user's environment. The "trickiest" part will be to find what code is necessary to track down the users "home directory" on each different operating system. Hope this helps. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: paramter passing question

2006-08-04 Thread Larry Bates
win = MyFrame2(self, -1, "", sim_name=sim_name) win.Show(True) class MyFrame2(wx.Frame): def __init__(self, *args, **kwds): . . self.sim_name=kwds.get('sim_name',

Python 2.5b2 and excepthook problem

2006-08-07 Thread Larry Bates
n isn't called because the print statement isn't executed upon entering the function. Has something changed that I missed? Thanks in advance for any assistance. Regards, Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting previous file name

2006-08-07 Thread Larry Bates
> Just some quick ideas (not tested): change test1.append(create_date) to test1.append((create_date, filename)) that way the filename will tag along during the sorting as a tuple in the test1 list. You will also need to change prev_file = walktree(path) to create_date, prev_file = walktree(p

Re: Best way to construct an email - attach a html file and send

2006-08-09 Thread Larry Bates
to > myself whenever there is an error in the application > > thanks a lot > py > Here is a link to a class that will allow you to attach files. You can either write the HTML to a tempfile and attach or modify a little to accept a string or cstringIO object instead. H

Re: seaching a list...

2006-08-10 Thread Larry Bates
king for and let the database do the searching. I can promise you this will almost always be faster and more flexible. Something like: Assume the columns are called rownumber, c1, c2, c3, c4 and the table is indexed on c1, c2, c3, and c4. This will happen almost instantly no matter how many rows you

Re: some n00b question

2006-08-11 Thread Larry Bates
Omar wrote: > I'm learning how to program python. a few questions > > a) I'm mostly interested in creating exe's that have to do with music > -- things to help me keep track of chord progressions, transpositions, > etc. can anyone point me in the direction of resources on this? > > b) I'm also

Re: A little assistance with os.walk please.

2006-08-14 Thread Larry Bates
dirs, you can delete them from the dirs list here and they won't get walked. You MUST delete them in place with del dirs[n] or dirs.pop or some other function that deletes in-place. You might want to type: help(os.walk) to get some more info. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling wxPython app for Windows; Single EXE

2006-08-14 Thread Larry Bates
nstaller can help you with all these things. The combination of py2exe and Inno Installer is hard to beat. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory problem

2006-08-14 Thread Larry Bates
in ? > MemoryError > > Any way to get around this problem? I have a machine of 4G memory. The > total number of data points (float) that I need to read is in the order > of 200-300 millions. > > Thanks. > On my 1Gb machine this worked just fine, no memory error. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory problem

2006-08-14 Thread Larry Bates
Yi Xing wrote: > On a related question: how do I initialize a list or an array with a > pre-specified number of elements, something like > int p[100] in C? I can do append() for 100 times but this looks silly... > > Thanks. > > Yi Xing > Unlike other languages this is seldom done in Python. I t

Re: Adding a char inside path string

2006-08-16 Thread Larry Bates
Sounds like you can split the string on a space and throw away the right side: s='\\serverName\C:\FolderName1\FolderName2\example.exe' -u ABC -g XYZ p=s.split(" ", 1)[0] print p '\\serverName\C:\FolderName1\FolderName2\example.exe' Larry Bates Hitesh wrote:

Re: Dynamic objects

2006-08-17 Thread Larry Bates
f AddEquipment(name, data): equipment[name]=Equipment(data) same for Equipment class and Component class. class Equipment: def __init__(self): self.components={} def AddComponent(name, data): components[name]=Component(data) class Component: def __init__(self, data) self.data=data -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Py2Exe and sys.argv : The Lost Arguments

2006-08-17 Thread Larry Bates
7;t work at all (not sure why). Funny thing is that if I select two .txt files and do a Open With Notepad, Explorer only opens one of them. So I think it is Explorer that is throwing away the extra arguments. Otherwise I would expect it to open multiple notepad instances. -Larry Bates Thomas

Re: Need advice on how to improve this function

2006-08-21 Thread Larry Bates
Matthew Wilson wrote: > I wrote a function that converts a tuple of tuples into html. For > example: > > In [9]: x > Out[9]: > ('html', > ('head', ('title', 'this is the title!')), > ('body', > ('h1', 'this is the header!'), > ('p', 'paragraph one is boring.'), >

Re: uploading files to file system/zipping/downloading problems

2006-08-21 Thread Larry Bates
data f.write(total_data) f.close You should take a look at shutil module. It is copyfile method that makes your code must simpler (and faster I'm sure). do import shutl help(shutil.copyfile) import shutil shutil.copyfile(uload_file_name, target_file_name) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: CONSTRUCT - Module Attributes and Execution Environment

2006-08-22 Thread Larry Bates
lazaridis_com wrote: > I would like to change the construct: > > if __name__ == '__main__': > > to something like: > > if exec.isMain(): > > My (OO thought) is to place a class in an separate code module and to > instantiate an singleton instance which would keep th something like > this: > >

Re: Accessing application data portably

2006-08-23 Thread Larry Bates
ws I use Inno Installer and it can modify these options inside the .ini file during the installation so that datafilepath points to where my data actually will live. Works perfectly for me. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: CONSTRUCT - Module Attributes and Execution Environment

2006-08-23 Thread Larry Bates
Georg Brandl wrote: > Larry Bates wrote: >> lazaridis_com wrote: >>> I would like to change the construct: >>> >>> if __name__ == '__main__': >>> >>> to something like: >>> >>> if exec.isMain(): >>> &

Re: Best way to construct an email - attach a html file and send

2006-08-23 Thread Larry Bates
a wrote: > where is the link > thanks a lot for your kind help > Larry Bates wrote: >> a wrote: >>> What is the best way to construct an email in python and also attach a >>> html file >>> >>> the html file to be attached is not on disk, but

Re: how to get file name of the running .py file

2006-08-23 Thread Larry Bates
Jason Jiang wrote: > Hi, > > How to get the name of the running .py file like the macro _FILE_ in C? > > Thanks. > Jason > > > import os import sys print sys.argv[0] or if you just want the script and not the full path print os.path.basename(sys.argv

Re: Accessing application data portably

2006-08-23 Thread Larry Bates
Tom E H wrote: > Larry Bates wrote: >> Tom E H wrote: >>> My Python application includes some data files that need to be accessed >>> by modules I distribute with it. >>> >>> Where can I put them, and how should I arrange my code, so that it works >

Re: Where is Python in the scheme of things?

2006-10-04 Thread Larry Bates
it was getting completely unmanageable. If you only have to deal with GUI apps on Windows I guess VB or Delphi would be fine. If you need to deploy to multiple platforms (Windows, Linux, Mac) IMHO neither of them will work very well. C++ is as portable, but the extra code that you must write

Re: Request for recommendations: shared database without a server

2006-10-05 Thread Larry Bates
hat it would work for small number of users. With some good planning you should also be able to architect application so that you can even change the underlying database later without too much heartburn. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Need array help

2006-10-06 Thread Larry Bates
; You have two choices in Python: list or array For simple lists of things use a list. If you want to do vector math or matrix-type calculations look at the array module. For you simple example, here is the python code: acctfile=[] numoffiles=4 data=10 ct=1 for i in xrange(numoffiles-1): ac

Re: Need array help

2006-10-06 Thread Larry Bates
Robert Kern wrote: > Larry Bates wrote: > >> If you want to >> do vector math or matrix-type calculations look at the >> array module. > > The array module in the standard library does not provide such > capabilities. If you need them, look at numpy. > &

Re: can regular ol' python do a php include?

2006-10-10 Thread Larry Bates
y just use that. > > I get the feeling the answer is no, but maybe there's something I've > missed that will allow me to do this. > > Thanks. You might want to review: http://karrigell.sourceforge.net/ This comes just about as close to PHP-style "includes" (your term) as I have seen. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Experiences with Py2Exe

2006-10-11 Thread Larry Bates
can't speak to Perforce python module as I've never used it myself. Start with a small console app and them move on to more complex applications. You may want to take a look at the py2exe newsgroup (gmane.comp.python.py2exe) for any questions. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Experiences with Py2Exe

2006-10-11 Thread Larry Bates
s very well, is free, and seems to do everything people want in an installer. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Newbie question

2006-10-13 Thread Larry Bates
ave only 1 file (setup.exe) that needs to be distributed. Doesn't really matter ho many files it installs when it runs, that's all hidden from the user anyway. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: always raise syntax error!

2006-10-13 Thread Larry Bates
readers out here. Occassionally I will have phantom syntax errors that seem to be attributable to non-printing characters in a line. Other times the error is in fact far above the place pointed to by the syntax error. Start by commenting out large chunks of code with triple quotes a

<    1   2   3   4   5   6   7   8   9   10   >