Re: Cleaning strings with Regular Expressions

2005-09-06 Thread Larry Bates
May not be what you are looking for, but this works: import os s='setAttr ".ftn" -type "string" ' \ '/assets/chars/boya/geo/textures/lod1/ppbhat.tga";' fname=os.path.basename(s.split()[-1]) BTW-It does depend on the file/path being the last it

Re: job scheduling framework?

2005-09-08 Thread Larry Bates
Google turned up these links that might be of interest: http://www.foretec.com/python/workshops/1998-11/demosession/hoegl/ http://www.webwareforpython.org/Webware/TaskKit/Docs/QuickStart.html http://www.slac.stanford.edu/BFROOT/www/Computing/Distributed/Bookkeeping/SJM/SJMMain.htm Larry Bates

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Larry Bates
Question: Why not just use Python to read the file? f=open(filename, 'rb') fcontents=f.read() If you need to manipulate what is in fcontents you can use struct module and/or slicing. Larry Bates Lil wrote: > Hi Everyone! I've been trying to figure out this weird bug in my &

Re: python script under windows

2005-09-09 Thread Larry Bates
Making a Python program into a service isn't all that "tedious". Get a copy of Mark Hammonds "Python Programming on Win32" which contains excellent examples on how to do this. I've written several and after the first one, it is quite easy to do. -Larry Bates

Re: simple problem with os.rename() parameters - path with spaces

2005-09-09 Thread Larry Bates
Are you sure the source directory exists and you have rights to rename it? Because the rename works for me. But you may want to look at shutil.move and/or use forward slashes (they work under Windows) -Larry Bates Tom wrote: > I'm having a problem using a path with spaces as a para

Re: nested tuples

2005-09-09 Thread Larry Bates
The first question is why do you need tuples? But this works: import csv filename=r'C:\test.txt' fp=open(filename,'r') reader=csv.reader(fp) tlines=tuple([tuple(x) for x in reader]) fp.close() Larry Bates Luis P. Mendes wrote: > Hi, > > I'm trying to so

Re: How to handle very large MIME Messages with the email package?

2005-09-12 Thread Larry Bates
h better way to send 100Mb files. Larry Bates [EMAIL PROTECTED] wrote: > Looking at the email package, it seems all the MIMExxx classes takes > string but not file object as the payload. I need to handle very large > MIME messages say up to 100M. And possibly many of them. Is email > pa

Re: OCR librarys

2005-09-12 Thread Larry Bates
You need to specify a "platform" you will be running on. I've had good experience with ExperVision's RTK toolkit on Windows. It is not free, but it is very, very good. Sometimes software is actually worth paying for ;-). Larry Bates Timothy Smith wrote: > i'm l

Re: Python and SMB, again...

2005-09-13 Thread Larry Bates
You might want to take a look at Webdrive (www.webdrive.com). It does what I "think" you are describing for ftp, http, https, and WebDAV. -Larry Bates Atila Olah wrote: > On 1997/06/05 Peter Henning wrote: > >>SMB, ldap, imap4rev1 >> >>Is there an SMB librar

Re: p2exe using wine/cxoffice

2005-09-13 Thread Larry Bates
I know Thomas Heller monitors this list but you should probably post this to gmane.comp.python.py2exe as it is the py2exe newsgroup. FYI, Larry Bates James Stroud wrote: > Hello, > > My department has switched from vmware to wine/cxoffice. I have been playing > with this all morni

Re: Unexpected Behavior Iterating over a Mutating Object

2005-09-13 Thread Larry Bates
ot x.endswith('DEL')] This also is much easier to read (IMHO) than the loops, etc. of the original code. In Python 2.4 list comprehensions are also quite efficient. Larry Bates Dave Hansen wrote: > OK, first, I don't often have the time to read this group, so > apologies if this

Re: Printing w/o newlines inside loops - odd behavior

2005-09-13 Thread Larry Bates
Take a look at this recipe which is part of the latest Python Cookbook. I think it will help you. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207 Larry Bates Jeffrey E. Forcier wrote: > This is a difficult issue to search for, and Googling (and reviewing > the pertinent

Re: Python CSV writer confusion.

2005-09-15 Thread Larry Bates
(not tested): import csv . . . outfile=open(r'D:\path\to\filename_sort1.csv', 'w') CSVwriter=csv.writer(outfile, dialect='excel', delimiter='|') CSVwriter.writerows(images) Larry Bates > > > if __name__ == '__main__': > images = read_i

Re: Creating Pie Chart from Python

2005-09-15 Thread Larry Bates
ReportLab Graphics. -Larry Bates Thierry Lam wrote: > Let's say I have the following data: > > 500 objects: > -100 are red > -300 are blue > -the rest are green > > Is there some python package which can represent the above information > in a pie chart? &

Re: Accessing shared library file...

2005-09-15 Thread Larry Bates
You need to tell us what library file (.dll) are you accessing on Windows. The interface to whatever the .dll is used for will most likely be completely different on Linux. -Larry Bates Ernesto wrote: > I'm in the process of moving a Python application from Windows to > Linux. This

Re: encryption with python?

2005-09-16 Thread Larry Bates
I've successfully used this toolkit to implement AES encryption in a recent project. http://www.amk.ca/python/code/crypto -Larry Bates Robert Kern wrote: > Ed Hotchkiss wrote: > >>What's the best module for encryption with python, anyone out there >>using py

Re: Lines of Strings

2005-09-16 Thread Larry Bates
If these were the lines what would the output look like? >From your example it doesn't appear that any of the lines would be eliminated. Larry Bates Reem Mohammed wrote: > Hi > > Suppose we have data file like this one (Consider all lines as strings ) > > 1 2 3 3 4 4

Re: dictionary to file

2005-09-16 Thread Larry Bates
ook for alternatives. It will take some time to read the dictionary and to unpickle it. -Larry Enrique Palomo Jiménez wrote: > Hi all, > > I'm writing an application who needs to handle a lot of information of > several files. > So, i think the better way is design a batch p

Re: very high-level IO functions?

2005-09-19 Thread Larry Bates
te a class with a interator that can read the data from the file/table and return the PROPER data types as lists, tuples, or dictionaries that are easy to manipulate. -Larry Bates York wrote: > Hi, > > R language has very high-level IO functions, its read.table can read a > total .csv

Re: very high-level IO functions?

2005-09-19 Thread Larry Bates
t;value2" # "1","2","3" # "2","4","5" # "3","6","7" table=csv.DictReader(fp) for record in table: # # Record is a dictionary with keys as fieldnames # and values of the data in each record #

Re: Object default value

2005-09-20 Thread Larry Bates
The prints can be done by defining an __str__ method on the class, but I don't think you will get the type(obj) to work the way you want. class obj(object): __default=1 y=2 def __str__(self): return str(self.__default) myobj=obj() print "myobj=", myobj print "myobj.y=", myobj

Re: What am I doing wrong?

2005-09-21 Thread Larry Bates
f, folders = None): self.folders=folders or [] -Larry Bates keithlackey wrote: > I'm relatively new to python and I've run into this problem. > > > DECLARING CLASS > > class structure: > def __init__(self, folders = []): >

Re: Access CSV data by column name..

2005-09-21 Thread Larry Bates
'c:\test.txt','r') inputfile=csv.DictReader(fp) for record in inputfile: print record fp.close() {'city': 'Atlanta', 'name': 'James R. Smith', 'zip': '30301', 'telephone': '4045551212', '

Re: Performance Issues of MySQL with Python

2005-02-09 Thread Larry Bates
this area, YET. I hope my random thoughts are helpful. Larry Bates sandy wrote: Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to know how will the speed be, wh

Re: Datatype of non-negative values

2005-02-09 Thread Larry Bates
What exactly do you want to happen when result would be negative? I'll guess be zero: pseudocode: x=value x=max(x-something, 0) That way if it goes negative, it sticks to zero. Larry Bates Dirk Hagemann wrote: Hi, Is there a datatype in python which allows no negative values? I subtract se

Re: two questions - no common theme

2005-02-09 Thread Larry Bates
sted) also. Larry Bates Sean McIlroy wrote: And now for a pair of questions that are completely different: 1) I'd like to be able to bind callbacks to presses of the arrow buttons on the keyboard. How do you say that in Tkinter? 2) The function 'listdir' in os.path returns a list of a

Re: Newbie: SWIG or SIP?

2005-02-09 Thread Larry Bates
orked with .DLLs from many different manufacturers. Tricky part is having a full definition of API to dll (e.g. argument types) and using struct module to communicate between Python and the .DLL. Larry Bates Brent W. Hughes wrote: I have a third-party DLL and it's associated .h file. The DLL w

Re: Commerical graphing packages?

2005-02-11 Thread Larry Bates
ReportLab has pretty good Graphics Module. About the only thing it needs is Python Imaging Library (which you would probably want anyway). Larry Bates Erik Johnson wrote: I am wanting to generate dynamic graphs for our website and would rather not invest the time in developing the code to

Re: dos box appears when clicking .pyc

2005-02-12 Thread Larry Bates
Change the association for .pyc files to pythonw.exe from python.exe. Larry Bates Philippe C. Martin wrote: Hi, For a few months now, I have been used .pyc script under XP without getting the "DOS" box. I just re-installed the scripts on another XP box and am now getting the DOS box ! So

Re: Tuple index

2005-02-20 Thread Larry Bates
Tuples don't have all the nice methods that lists have so convert it to a list. tuple=('a','b','c','d') l=list(tuple) now you can do: list.index('c') which returns 2 Remember index returns -1 when nothing is found. Larry Bates Steve

Re: A few q's on python files.

2005-02-21 Thread Larry Bates
this takes some getting accustomed to. Larry Bates Joseph Quigley wrote: > hiya, > i'm new to python (by a week) but am learning fast (that's what I like > about python--it's simplicity). I got disgusted with C and C++ (i was > learning) probably because of a bad co

Re: web status display for long running program

2005-02-25 Thread Larry Bates
Not exactly on point, but this is what I use in many of my programs to show progress on long running console apps. Larry Bates class progressbarClass: def __init__(self, finalcount, progresschar=None): import sys self.finalcount=finalcount self.blockcount=0

Re: Splitting strings - by iterators?

2005-02-25 Thread Larry Bates
) I don't think I would never read 400,000 lines as a single string and then split it. Just a suggestion. Larry Bates Jeremy Sanders wrote: > I have a large string containing lines of text separated by '\n'. I'm > currently using text.splitlines(True) to break the text

Re: Splitting strings - by iterators?

2005-02-25 Thread Larry Bates
By putting them into another file you can just use .readline iterator on file object to solve your problem. I would personally find it hard to work on a program that had 400,000 lines of data hard coded into a structure like this, but that's me. -Larry Jeremy Sanders wrote: > On Fri

Re: Controlling Pc From Server?

2005-02-28 Thread Larry Bates
egitimate reason for people to be at that site. Hope info helps. Larry Bates [EMAIL PROTECTED] wrote: > Hello Kartic & NG, > > Thank you for your prompt answer. In effect, I'm trying to work on > a NT network of 6 PC (plus the server). Sorry to not have been clearer. >

Re: Working with dbase files

2005-02-28 Thread Larry Bates
On MS Windows use built in ODBC support to xBase files which supports read and write access. Larry Bates Stan Cook wrote: > Does anyone know how I can access and read data from a dbase (.dbf) file? > > Regards, > > Stan -- http://mail.python.org/mailman/listinfo/python-list

Re: ZoDB's capabilities

2005-02-28 Thread Larry Bates
There is a VERY large website that uses Zope/ZODB that takes up to 9000 hits per second when it gets busy. ZODB is very fast and holds up well under load. You should probably look at Plone. It is CMS already built on top of Zope. Might safe you a LOT of work. Larry Bates Almad wrote

Re: binutils "strings" like functionality?

2005-03-03 Thread Larry Bates
Take a look at python's struct module in the standard library. Many people use it to manipulate binary objects at the byte level with great success. Larry Bates cjl wrote: > Hey all: > > I am working on a little script that needs to pull the strings out of a > binary file, an

Re: enum question

2005-03-04 Thread Larry Bates
t;> x.value=11 error, x not in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> x.value=8 >>> Larry Bates M.N.A.Smadi wrote: > does python support a C-like enum statement where one can define a > variable with prespesified range of values? > > thanks > m.smadi -- http://mail.python.org/mailman/listinfo/python-list

Re: programmatically calling a function

2005-03-07 Thread Larry Bates
for fname in fnames: xfer[fname](args) May not be what you want, but seems like it is from your description. -Larry Dave Ekhaus wrote: > hi > > i'd like to call a python function programmatically - when all i > have is the functions name as a string. i.e. > >

py2exe error: 2.4.2.4: No such file or directory

2005-03-07 Thread Larry Bates
ith py2exe-0.3.3 + Searching modules needed to run 'HTMLmenu.py' on path: ['F:\\SYSCON\\WTS\\HTMLmenu\\build\\bdist.win32\\winexe\\lib\\Python22\\Lib\\sit e-packages', '', 'F:\\Larry\\Python', 'C:\\Python22

Re: py2exe error: 2.4.2.4: No such file or directory

2005-03-08 Thread Larry Bates
Thomas, Right on the mark. Thanks for the help. Larry Bates Thomas Heller wrote: > Larry Bates <[EMAIL PROTECTED]> writes: > > >>I had occasion to look back at a project I did over a year ago >>and needed to make one small change. I use py2exe to package >

Re: os.walk(entire filesystem)

2005-03-09 Thread Larry Bates
d Windows tries to read a directory and errors. Just follow what Peter Hansen has suggested and write a wrapper function that calls os.walk repeatedly for all the actual drives in your system that are readable at all times. It isn't all that hard. Larry Bates rbt wrote: > More of an OS

Re: modifiable config files in compiled code?

2005-03-10 Thread Larry Bates
es that are required to registry or my .INI file. 4) Have Inno Installer compile everything together into setup.exe viola' you have a single file that can be installed on any computer that will run without Python installation. -Larry Bates [EMAIL PROTECTED] wrote: > Hi All, > > I

Re: Logging global assignments

2005-03-11 Thread Larry Bates
are > probably doomed to failure. > > Is there any way of injecting some of my code into the process of > global name binding, or some other means of "capturing" global > assignments ? Suggestion: Use ConfigParser to set your globals instead and you can track yo

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Larry Bates
bs-mode: nil >sentence-end-double-space: t >fill-column: 70 >End: I also don't miss a no-space option on print. I've always believed that print statements with commas in them were for simple output with little or no regard for formatting (like for debugging statements). If I want precisely formatted output I use '%' formats or I build the output line manually with joins or some other mechanism. The ''.join(seq) or ''.join([fn(x) for x in seq]) says exactly what is being done to create the output string. I fail to see why your proposed solution of: for x in seq: print fn(x),, print is clearer than: print ''.join([fn(x) for x in seq]) Also your statement: print 'The phone number is (',,extension,,')', number,,'.' requires three double commas and can already be written more clearly as: print 'The phone number is ('+extension+') '+number'.' or even more clearly (as you stated) print 'The phone number is (%s) %s' % (extension, number) Just my 2 cents. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: executing non-Python conde

2005-03-11 Thread Larry Bates
control you want and/or if it is a Windows GUI .exe. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: PythonWin

2005-03-14 Thread Larry Bates
;) f.SetOFNTitle("Open Text File") result=f.DoModal() if result == win32con.IDCANCEL: sys.exit() print "path selected=", f.GetPathName() print "Filename selected=", f.GetFileName() Hope it helps. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing C readable bitfield structs?

2005-03-16 Thread Larry Bates
> struct.pack is in the Standard Library and allows you to do what you want. You may find that you must also do some "bit twiddling" using << shift functions and | bit or function if you want to pack tighter than on 4 bit boundaries. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser

2005-03-17 Thread Larry Bates
tartswith('password_')] passwordentries.sort() # If you want to process them in order or to get list of passwords passwordlist=[INI.get(section, pk) for pk in passwordentries] Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create datetime object from DbiDate (win32.odbc)?

2005-03-17 Thread Larry Bates
time object manually. However, if > I try dir(d), where d is a DbiDate object, I get an empty list, so I > cannot even see how to extract the elements. > > Does anyone know if this is possible, and if so, how? > > Many thanks > > Frank Millman > I've always used

Re: create/access dynamic growth list

2005-03-18 Thread Larry Bates
ll take a shot. fp=open(conf_data, 'r') macro_lines=fp.readlines() fp.close() After this macro_lines will be a list with one line per element such that macro_list[0] is the first line, macro_list[1] the second, etc. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Building web graphics with Python

2004-11-29 Thread Larry Bates
ReportLab Graphics module can produce graphics and then save into many formats via Python Imaging Library (PIL). Larry Bates Steven Feil wrote: I am wondering if there is a light weight Python library for producing web graphics on-the-fly. There is a C-language library called gd that can be used

Re: disk based dictionaries

2004-12-02 Thread Larry Bates
/adytumsolutions/HowToLoveZODB_PartII/HowToLoveZODB_PartI http://www.h7.dion.ne.jp/~harm/ZODB-Tutorial.py Larry Bates Shivram U wrote: Hi, I want to store dictionaries on disk. I had a look at a few modules like bsddb, shelve etc. However would it be possible for me to do the following hash[1] = [1, 2, 3] where

Re: Display Adapter Information from Registry?

2004-12-03 Thread Larry Bates
This eliminates the need to have Python (and any extensions) installed on the target machines. I (and many others) do this for all my Windows software that is to be distributed. Hope information helps. Larry Bates Omer Ahmad wrote: Hi All, I've been working with python for about 6 months now, and

Re: Sorting in huge files

2004-12-07 Thread Larry Bates
mysql database if you want other processing on the records. The alternative is a good high-speed sort like Syncsort, etc. Good Luck, Larry Bates Paul wrote: Hi all I have a sorting problem, but my experience with Python is rather limited (3 days), so I am running this by the list first. I have a large

Re: Python 2.3.5 ?

2004-12-07 Thread Larry Bates
Just because 2.4 arrives doesn't mean that ALL work is stopped on 2.3. It is quite common to have releases overlap. The very newest release is put out (2.4) , but bugs are still being fixed in older (2.3). Larry Bates Luis M. Gonzalez wrote: I'm confussed... Python 2.4 (final) hs bee

Re: Clarification of two concepts (or maybe one?)

2004-12-11 Thread Larry Bates
necessary python .dlls. 2) Something to create a distribution. On Windows a popular choice seems to be Inno Installer. It creates a single setup.exe file that can be distributed and is very flexible. Hope info helps. Larry Bates Syscon, Inc. Fredrik Lundh wrote: Eddie Parker wrote: What I’m

Re: Fun with Outlook and MAPI

2004-12-11 Thread Larry Bates
messages. http://motion.technolust.cx/related/send_jpg.py Here is a link to a class that wraps everything up very nicely. You should be able to be sending SMTP emails with it in 10-15 minutes. It supports binary attachments as well. FYI, Larry Bates Chris wrote: I'm trying to send an e-mail th

Re: predict directory write permission under windows?

2004-12-13 Thread Larry Bates
My method isn't elegant, but I use tempfile to create a tempfile in the directory (inside a try block). If it works, closing the file makes it go away. Larry Bates Syscon, Inc. Qiangning Hong wrote: I want to know if I can write files into a directory before I actually perferm the write be

Re: Accessing DB2 with Python

2004-12-16 Thread Larry Bates
I just tried the link at it works from here. Site has source and Windows binary versions of software. Looks loke it is being maintained. Windows binary for Python 2.3 was added in September 2004. No 2.4 binary. Larry Bates Syscon, Inc. Shawn Milo wrote: Is anyone doing this? I would like to

Re: Permission

2004-12-17 Thread Larry Bates
will be precise. Permisssion denied means that you don't have permission to rename this file. Normally this is a rights issue. BTW-os.rename works on XP. Larry Bates Syscon, Inc. -g00t©- wrote: --( oo )-- I don't know if there's a beginner board, just tell me if it&#x

Re: expression form of one-to-many dict?

2004-12-17 Thread Larry Bates
Steven, Suggestion: It is a bad idea to name any variable "map". When you do, you destroy your ability to call Python's map function. Same goes for "list", "str", or any other built-in function. If you haven't been bitten by this you will, I was. Larry

Re: Emailing in Python

2004-12-14 Thread Larry Bates
Great class for making this very easy located here: http://motion.sourceforge.net/related/send_jpg.py And is supports list of binary attachments that is pretty tricky by hand. Larry Bates Syscon, Inc. Philippe Reynolds wrote: Hi, I'm learning python...one of my tasks is to send out emails

Re: how to pass globals across modules (wxPython)

2004-12-20 Thread Larry Bates
self.mainFrame.Show() self.SetTopWindow(self.mainFrame) return True This might not be the "best" way, but seems to work and models what wxWindows appears to do internally. Larry Bates Syscon, Inc. Martin Drautzburg wrote: My wxPython program starts execution in mainFrame.py like this

Re: Lowest hassle Python web server?

2005-03-23 Thread Larry Bates
thon than Java? > - Is there anything similar to JSP in Java? > > Thanks, > KanZen > You might want to take a look a Medusa. It is the basis for the web server that is bundled in Zope. http://www.nightmare.com/medusa/ Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern matching from a text document

2005-03-24 Thread Larry Bates
CSV module (for reading comma delimited files) or you might just be able to use simple .split() method (for tab delimited files). Hope info helps. Regards, Larry Bates Ben wrote: > I'm currently trying to develop a demonstrator in python for an > ontology of a football team. At presen

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Larry Bates
ually the introduction of functions/classes that divide the deeply nested grouping into more manageable and debuggable pieces. Larry Bates Tim Tyler wrote: > What do you guys think about Python's grouping of code via indentation? > > Is it good - perhaps because it saves space a

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Larry Bates
ng, but it is consistent with other languages that allow single-line blocks this freedom and I don't have a problem with "you can put one line after the colon but not more than one" rule. Larry Bates James Stroud wrote: > On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote

Re: Suggest more finesse, please. I/O and sequences.

2005-03-25 Thread Larry Bates
d, count in wordsLst: outFile.write("%7s : %i\n" % (word, count)) I guess you assumed all your words were less than 7 characters long (which I copied). But there are many other "good" ways I'm sure. Larry Bates Qertoip wrote: > Would you like to suggest me any improvem

Re: breaking up is hard to do

2005-03-25 Thread Larry Bates
'trace': 0, 'debuglevel': 2, 'outputfile': 'outfile.txt'} F=foo(**global_dict) Then if your nesting goes deeper, just pass **kwargs to functions or classes that are lower down. Hope this helps. Larry Bates bbands wrote: > I've a 2,000 line and g

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
ficult. You need to interface with Windows GDI. If this is the case, take a look at wxPython interface to wxWindows (see printPreview) or you can use Mark Hammonds Windows utilities. FYI, Larry Richard Lyons wrote: > I'm just starting to work with Python. Have had a little experience

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

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 m

Our Luxurious, Rubinesque, Python 2.4

2005-03-31 Thread Larry Hastings
luding, or is it all fundamental VM stuff that couldn't possibly be removed? Thanks, /larry/ -- http://mail.python.org/mailman/listinfo/python-list

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

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

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