Re: query

2006-12-21 Thread Larry Bates
favorite is PyScripter available at: http://mmm-experts.com/Products.aspx?ProductId=4 Another good choice is Eclipse with Python plug-in but it is a very large application. If you do Java and other development as well as Python that might be an excellent choice. -Larry -- http://mail.python.or

Re: Newbie: what is a usefull IDE for Python on Windows ?

2006-12-26 Thread Larry Bates
pyscripter, available here: http://mmm-experts.com/Products.aspx?ProductId=4 -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: can't instantiate following inner class

2006-12-27 Thread Larry Bates
ould never access it again in the future. It would then be thrown away by garbage collection. Proper way is: class One: def __init__(self): self.Two=Two() Of course Two must be a proper class definition also. class Two: def __init__(self): self.Three=Three() class

Re: I want to see all the variables

2006-12-29 Thread Larry Bates
es and functions you will almost certainly have to look at the source code to make sure of what they are and how they can be utilized. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Easiest way to print from XP/DOS.

2006-12-29 Thread Larry Bates
to the printer as it > does in win98. > > jim-on-linux > I don't get any such message on my XP Pro Service Pack 2 system here using your method. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Execute binary code

2007-01-08 Thread Larry Bates
hat you are asking is a virus/trojan "like" program. There's no reason you shouldn't be able to write the code to TEMP directory and execute it. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Using with CSV library in Python 2.2!!!

2007-01-09 Thread Larry Bates
estions. Thanks in advance. > > Cheers, > Mohan. > Object Craft wrote the csv library that predated the one released in Python 2.3. You can still get it for earlier Python versions here: http://www.object-craft.com.au/projects/csv/download.html -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: mxODBC problems

2007-01-09 Thread Larry Bates
uot;", line 1, in > AttributeError: 'NoneType' object has no attribute 'fetchall' > > Thanks, > Sean > I think you will find that there result returned by the cur.execute is None upon success. You probably meant: cur.execute('SELECT * FROM g_rif') table=cur.fetchall() Then process table. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Summarizing data by week

2007-01-09 Thread Larry Bates
> Generally I always check the day of week (DOW) of the beginning and ending dates in the sequence and adjust them so that they align with "real" weeks. Then it is usually as easy as adding 7 days inside the loop to increment each row. I'm not 100% sure I understand the problem but perhaps this will help. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading a Python collection from an text-file

2006-01-24 Thread Larry Bates
Take a look at ConfigParser module. The format of the file would be something like: [members] peter=16 anton=21 People are accustomed to this format file (windows .ini format). -Larry Ilias Lazaridis wrote: > within a python script, I like to create a collection which I fill with >

Re: Pulling numbers from ASCII filename not working

2006-01-24 Thread Larry Bates
names = [filename.lower() \ for filename in filenames \ if (filename[-4:].lower() == ".asc" and filename[0] != "-" )] is better rewritten as (not tested): import glob filenames=glob.glob(os.path.join(gp.workspace, '*.asc')) filenames = [f.lower() for f in filenames if not f.st

Re: replacing \n characters in a hash

2006-01-26 Thread Larry Bates
> > where errata_package is JUST the errata_topic hash value. > > Any advice would be great on how to do that. > > Regards, > > Johhny > You must use 'errata_topic' as index into your dictionary to get the string and then replace the \n chars. Example assumes that the dict is pointed to by d): errata_topic_text=d['errata_topic'].replace('\n',' ') Hope this helps. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing numbers into characters using dictionaries

2006-01-26 Thread Larry Bates
Documents/python/changetext.py", line 9, in ? > var = str(a[t[something]]) > KeyError: '7704' > > I've explained what is needed to happen in the comments. Also, if any of > you can think of a better way to do this can you possibly tell me this? > Thanks. text = '@[EMAIL PROTECTED]@[EMAIL PROTECTED]' a={'7704':'l','7002':'a','7075':'w'} u=[] for c in text.split('@')[1:]: u.append(a[c]) print ''.join(u) Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run a dos executable from python

2006-01-26 Thread Larry Bates
runtime so I need to pass them as arguments. > > Thanks > > > > Take a look at the subprocess module or on older versions of Python you can use os.spawn. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: 2-dimensional data structures

2006-01-26 Thread Larry Bates
e pointer and I will do > the rest. Probably the numeric module: http://numeric.scipy.org/ But you can also do nested lists. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamic class instantiation

2006-01-30 Thread Larry Bates
files instead of just defining everything as Python classes? Get good baseclass definitions and use OOP inheritance to create your specific class instances. I think mixing XML, language definition file (LDF), LDF to python parser is a LOT harder (and slower) than just writing the classes outright. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: winsound.MessageBeep

2006-01-30 Thread Larry Bates
Beep('MB_OK') > Traceback (most recent call last): > File "", line 1, in ? > TypeError: an integer is required > > So what do I need to do to play the other sounds listed in the docs (using > MessageBeep). Thanks. > > Louis > > You need to call winso

Re: dynamic class instantiation

2006-01-30 Thread Larry Bates
Ognen Duzlevski wrote: > Larry Bates <[EMAIL PROTECTED]> wrote: >>> Now I want to use something like xml.dom.minidom to "parse" the >>> .xml file into a set of classes defined according to the "language >>> definition" file. The parse() me

Re: Windows - create text file - (newb)

2006-02-02 Thread Larry Bates
Yes. To open file: fp=open(r'C:\directory\filename.txt','r') To open file to write to: fp=open(r'C:\directory\filename.txt','w') You probably need to go through the Python tutorial as these items are covered. -Larry Bates Ernesto wrote: > Can

Re: OS.MKDIR( ) Overwriting previous folder created...

2006-02-02 Thread Larry Bates
try os.path.exists(path) -Larry Bates Ernesto wrote: > Ernesto wrote: >> I couldn't find this with a search, but isn't there a way to overwrite >> a previous folder (or at least not perform osmkdir( ) if your program >> detects it already exists). Thanks ! >

Re: py2exe question

2006-02-03 Thread Larry Bates
on="1.50", options={"py2exe": {"compressed": 1, "optimize": 2, "bundle_files":1}}, ) If that doesn't help, you may want to post to the py2exe specific newsgroup at gmain.comp.python.py2exe. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Python on Windows

2006-02-03 Thread Larry Bates
if it was 50 Mb! > > TIA > > > Simon Use py2exe to create distribution and then use Inno Installer to create a single setup.exe file that can easily be distributed. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Extract contents of html cells

2006-02-04 Thread Larry Bates
You should take a look at for the screen-scraping part: http://www.crummy.com/software/BeautifulSoup/ To put them in your html page all you need to do is to have some placeholders in your html and use python to replace the placeholders with the values you get from the other screen. -La

Re: Webmail with Python

2006-02-04 Thread Larry Bates
iler written > in python? > > > Thomas > Google turned up the following: http://bobomail.sourceforge.net/ Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: How to I write DBASE files without ODBC

2006-02-07 Thread Larry Bates
is necessary for the program to access ODBC data source. All I did was to observe the changes in the registry before and after manually setting up a ODBC datasource and put that code in my Inno script. Works like a charm. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Hi reliability files, writing,reading and maintaining

2006-02-07 Thread Larry Bates
at a hosting facility that has rock-solid Internet pipes and generator backed power. It won't do any good to have a kick-ass server and software that can handle all types of failures if someone knocking over a power pole outside your office can take you offline. Hope info helps. -Larry Bates in a hosting facility -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining an operating system's default browser

2006-02-09 Thread Larry Bates
You don't have to determine it. Just os.startfile('page1.html') and let the OS figure it out. -Larry Bates John McMonagle wrote: > Is there a python module which can determine an operating system's > default web browser application. > > I would like to use it i

Re: appending to a list via properties

2006-02-10 Thread Larry Bates
e I understand, but here goes. I normally use list comprehensions. I'm assuming that calculate_something() is acting on a list of items. If not then maybe some underlying data refactoring is in order. If so you write: results=[calculate_something(x) for x in list_of_items] foo=result[x[

Re: Is python very slow compared to C

2006-02-11 Thread Larry Bates
l that is important right) for all but device drivers and highly scientific applications (and even then there are solutions). The parts of Python that need to be fast have been rewritten as binary libraries. That way you get the best of both worlds: high level language that has fast libraries when required. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Single-file executables

2006-02-13 Thread Larry Bates
nd py2exe imbeds the .ZIP file inside the .EXE file (making it somewhat harder to hack). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, Forms, Databases

2006-02-15 Thread Larry Bates
that I should look into > and these modules are the ones that will allow me to accomplish what I > am interested in doing? Thanks for your help. > I'll bet you'll find that the cheapest way to to this is to use PHP and MySQL (both free on even the lowest cost hosting plans). A

Re: how to get function names from the file

2006-02-15 Thread Larry Bates
Foo': printFoo, 'printFOO': printFOO} functions=('printFoo', 'printFOO') for function in function: if fdict.has_key(function: fdict[function]() else: print "No function named=%s defined" % function -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Encryption

2006-02-16 Thread Larry Bates
and if I have missed obvious docs please take it easy on me > - I am new here :-) > Take a look here. This package works perfectly for us. http://www.amk.ca/python/code/crypto -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Does python have an internal data structure with functions imported from a module?

2006-02-17 Thread Larry Bates
do this as follows: Create dictionary with the function names as keys and the pointer to function definition as value: def printFoo(): print "Foo" return def printFOO(): print "FOO" return fdict={'printFoo': printFoo, 'printFOO': printFO

Re: Class subscripting

2006-02-17 Thread Larry Bates
ion about what you are trying to accomplish before we can help. Just as a wild guess I think you want a dictionary. vdict=['baz1': 3.0, 'baz2': None} vdict['baz2']=4.2 print vdict['baz2'] if you insist on an index you can do: vars=['

Re: Tab Character?

2006-02-20 Thread Larry Bates
[EMAIL PROTECTED] wrote: > How do I make a tab character in code to split a line read with tabs in > it? > > > Thanks. > > Tom > You should also take a look at csv module. If you are reading lines that contain tab delimeted data the csv module can make splitting

Re: Newbie question: Multiple installations of Python on Windows machines

2006-02-20 Thread Larry Bates
er program on another computer I would (so as to not mess up 2.4.2 install). -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: fast text processing

2006-02-21 Thread Larry Bates
iled language. A good test is to copy the file and measure the time. You can't make your program run any faster than a copy of the file itself without making hardware changes (e.g. RAID arrays, etc.). You might also want to take a look at csv module. Reading lines and splitting on delimeters is almost always handled well by csv. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Little tool - but very big size... :-(

2006-02-21 Thread Larry Bates
Since the target is Windows only, consider using win32gui (part of Mark Hammonds win32 extensions) calls to use native Windows controls. That way you can eliminate wxWindows altogether. If all you need is a file dialog, it isn't very difficult. -Larry Bates Mikael Olofsson wrote: > D

Re: Basic coin flipper program - logical error help

2006-02-21 Thread Larry Bates
your homework, but I'll give you a clue. You need to get the your coin tosses inside your loop. Otherwise you only toss the coin once and then loop 100 times with the same value. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: DatBases and Pickle Module

2006-02-22 Thread Larry Bates
> Many thanks to you all > Math Using a database is good when you want to access data based on indexes or if you wish to have 1-n relationships between tables. Plain files don't handle this very well. If all you want to do is store raw data and get it back, look at pickle and shelve

Re: listdir() - any way to limit # of file entries?

2006-02-22 Thread Larry Bates
Use os.walk to iterate over each of these directories and add all the files contained in each day/month subdirectory into a .zip archive. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Unexpected timing results

2006-02-23 Thread Larry Bates
t isn't timing the > setup of the for loop. > > Any ideas what is causing the difference? I'm running Python 2.3 under > Linux. > > Thanks, > > > Steven, In timer2 you are making a million extra calls to timer() function and doing a million additions and a millio

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread Larry Bates
s not exist, > but ' XXX ' does indeed exist. > > Can anyone rescue me from this madness :( > > Many Thanks, > Brad How about not naming files with leading and trailing spaces on the Mac? Seems like a bad habit that needs breaking ;-). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread Larry Bates
rtilley wrote: > Larry Bates wrote: >> How about not naming files with leading and trailing spaces on >> the Mac? Seems like a bad habit that needs breaking ;-). >> >> -Larry Bates > > Users will be users! Tell that to the guys and gals on Macs who like to

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread Larry Bates
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 14:30:22 -0600, Larry Bates wrote: > >> How about not naming files with leading and trailing spaces on >> the Mac? Seems like a bad habit that needs breaking ;-). > > Why is it a bad habit? Because *Windows* is primitiv

Re: How would you open this file?

2006-02-23 Thread Larry Bates
ere for it to be saved. fp=open_file() print fp.read() fp.close() Others have pointed out the filename is a bad choice for a variable name as it is a pointer to a file object. Most tutorials and a lot of standard library code use fp. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Concantenation and string slicing

2006-02-23 Thread Larry Bates
("Enter a message: ") > letter = len(message) > while (letter > 0): > newMessage = "" > newMessage += message[letter-1] > letter -= 1 > print newMessage > > > Thanks!! > > Dan > Better was is: message = ra

Re: Exception not raised

2006-02-24 Thread Larry Bates
py", line 231, in test > print dont_exist > NameError: global name 'dont_exist' is not defined > > > So all the exception are raised except the KeyError outside the try/except! > > I don't know what can be. > > Thanks to all that can help me. &

Re: Regular expression fun. Repeated matching of a group Q

2006-02-24 Thread Larry Bates
' ' \ ' ' \ '08:14' c=BeautifulSoup.BeautifulSoup(test) times=[] for i in c.childGenerator(): if i.contents[0] == " ": continue times.append(i.contents[0]) date=times.pop(0) day=times.pop(0) print "date=", date print "day=", day print "times=", times -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple threaded download streams?

2006-02-25 Thread Larry Bates
hrough the pipes faster than their upper bandwidth. Just some thoughts to consider. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Grabbing a object from the current code block using a callable statement?

2006-02-25 Thread Larry Bates
ooclass'].method() in foo.method >>> Instances of classes are just like any other data you might put into a list or a dictionary. I hope that is what you were asking. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Concantenation and string slicing

2006-02-25 Thread Larry Bates
Dennis Lee Bieber wrote: > On Thu, 23 Feb 2006 18:06:46 -0600, Larry Bates > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >> Better was is: >> >> message = raw_input("Enter a message: ") >> print message[::-1] >>

Re: spaces at ends of filenames or directory names on Win32

2006-02-25 Thread Larry Bates
Jeffrey Schwab wrote: > Larry Bates wrote: > >> IMHO leading and/or trailing spaces in filenames is asking for >> incompatibilities with cross-platform file access. > > With what platforms specifically? > >> Much like >> using single-quote in filena

Re: spaces at ends of filenames or directory names on Win32

2006-02-25 Thread Larry Bates
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 17:49:31 -0600, Larry Bates wrote: > >> Steven D'Aprano wrote: >>> On Thu, 23 Feb 2006 14:30:22 -0600, Larry Bates wrote: >>> >>>> How about not naming files with leading and trailing spaces on >&

Re: including directories with py2exe

2006-02-27 Thread Larry Bates
t imported... > tnx > > Fabio > You may want to post to the py2exe-specific newsgroup at gmane.comp.python.py2exe. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: minimize a program into an icon on the taskbar.

2006-02-28 Thread Larry Bates
sTrayIcon.py.html Here is a link that says it works for KDE: http://rootprompt.org/article.php3?article=8294 This may help with gnome: http://www.realistanew.com/2005/04/19/bittorrent-tray-icon/ -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for Pythonic Examples

2006-02-28 Thread Larry Bates
t; Gerhard Pick up a copy of the Python Cookbook, it is full of examples. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Py2exe

2006-02-28 Thread Larry Bates
;bundle_files":1}} ) Of course replace 'server' with the name of your program. These are merely EXAMPLES. Your specific needs might be different depending on specifics of your program. Hope it helps. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Proper class initialization

2006-03-01 Thread Larry Bates
__(self, initialvalue=None): if initialvalue is not None: self.sum=initialvalue else:self.sum=0 for i in range(10): sum+=i b=A(sum) c=A(sum) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Stopping Windows Service

2006-03-01 Thread Larry Bates
y having SvcStop set the event flag so that the next time through your loop in SvcDoRun you see that the stop has been issued and exit your while loop. Here is some skeleton code that I stripped from a working service. Hope it helps. Note: I copied most of this from Mark Hammond and Andy Robinson

Re: How to find cause for Python/Pythonwin crash only on Dual Core Machines ?

2006-03-03 Thread Larry Bates
trl.SB_SETTEXT,iPane,extension.GetStringAddr(text)) > > > --- swig: > static PyObject *_wrap_GetStringAddr(PyObject *self, PyObject *args) { > PyObject *resultobj; > char *arg0 ; > int result ; > > if(!PyArg_ParseTuple(args,(char *)"s:GetStringAddr",&arg0)) return > NULL; > result = (int )GetStringAddr((char const *)arg0); > resultobj = PyInt_FromLong((long)result); > return resultobj; > } I've run on Dual 1.7, 2.4Ghz Xeon machines and a hyperthreaded 3.0Ghz machine for several years with no problems. I don't think there is an inherent problem. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: string stripping issues

2006-03-03 Thread Larry Bates
It parses HTML code and allows for extractions of data from strings like this in a very easy to use way. If this is a one-off thing, don't bother. If you do this commonly, BeautifulSoup is worth a little study. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing an OPC client with Python ?

2006-03-03 Thread Larry Bates
t; > Thanks for your help . > > Pierre > > > You can call methods/functions in a .dll using ctypes. http://starship.python.net/crew/theller/ctypes/ -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamically creating variables

2006-03-03 Thread Larry Bates
d pass it around. I'm not 100% sure I understand what you want to accomplish, but I hope this helps. Have digest return a dictionary of tokens/values. tokenDict=digest("FOR", "IDENT", "EQ", "INTVAL", "COLON") then refer to things as tokenDict['ident'], tokenDict['start'] -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing an OPC client with Python ?

2006-03-03 Thread Larry Bates
pierlau wrote: > Larry Bates a écrit : >> >> pierlau wrote: >> >>> Hello, >>> >>> I use an OPC server for connection to DC Drive. >>> I would like to write a small OPC client. >>> I have the dll OPCDAAuto.dll which contains al

Re: Stopping Windows Service

2006-03-03 Thread Larry Bates
quot;. They do some work and go to sleep for some period of time, then wake up and loop. The stop signal comes while they are asleep. When they wake up, they exit the infinite loop. If you can't implement a listen-with-timeout it is going to be hard to make this into a service. -Larry

Re: Running script in background.

2005-05-01 Thread Larry Bates
foreground and have it execute in the background (unlike on Linux). Larry Bates Harlin Seritt wrote: > Hi, > > I have a script.py that is converted to .exe using py2exe. From another > script I call script.exe and would like to be able to run this > script.exe in the background (as wel

Re: Python interpreter in Basic or a Python-2-Basic translator.

2005-05-01 Thread Larry Bates
the bullet and just learn and write in VB/VBA. -Larry Bates Engineer wrote: > I'm looking for a Python interpreter written in BASIC, preferably > Visual Basic, and one written in VBA would be best of all. An > alternative would be a Python-2-Basic compiler. > > Unfortunatel

Re: FTP/TLS connection using python

2005-05-04 Thread Larry Bates
I don't have direct experience by Google turned this up: http://trevp.net/tlslite/ Larry Bates scrimp wrote: > Hello, >I was wondering if there is any other way to securly connect to an > FTP site using SSL or TLS? I dont have the option of purchasing > M2Crypto from t

Re: include "apythonscript.py"

2005-05-09 Thread Larry Bates
How about? put apythonscript_function.py in a separate file then inculde apythonscript_function.py at the top of maincode.py Looks like you probably need to go back and read the tutorial. -Larry [EMAIL PROTECTED] wrote: > H! > > I'm trying to find a python function to

Re: Resize an Image without PIL

2005-05-09 Thread Larry Bates
PIL is the best way. Or you can call some external program to do it (using os.system). Larry Bates [EMAIL PROTECTED] wrote: > Hi I would like to know how to resize an Image without using python > Imaging library. > -- http://mail.python.org/mailman/listinfo/python-list

Re: Regarding Mail sending Module

2005-05-10 Thread Larry Bates
There is a great class for doing just this at: http://motion.technolust.cx/related/send_jpg.py I've used it many times and it has worked very well. -Larry Bates praba kar wrote: > Dear All, > In Php we can do all the mailing operations like > sending a text as a m

Re: Reading files into a 2D list.

2005-05-11 Thread Larry Bates
print "'%s'" % fpath lexi_file.close() # Remember to close each file Now you have: files_and_lines[0][0] -> Line 1 of the first file files_and_lines[0][1] -> Line 2 of the first file . . . files_and_lines[0][n] -> Line n of the first file files_and_lines[1][0] -

Re: HELP Printing with wxPython

2005-05-11 Thread Larry Bates
Mario, Here is a function stripped from a working program that uses printpreview from wxWindows to print out cells from a grid that the user is working on. Hopefully this can point you in the proper direction. Regards, Larry Bates def DO_printpreview(self, event): if self._trace

Re: doc tags?

2005-05-13 Thread Larry Bates
In python they are called decorators, but I've never had a need to use them myself, but then I'm a little old fashioned. Larry Bates Wolfram Kriesing wrote: > i was already searching and remember i had seen something like "its not > needed". > > Anyway, are

Re: String formatting strangeness

2005-05-13 Thread Larry Bates
The argument to string format expression needs to be a tuple not a list. Also, all the string escaping makes this very hard to read. You can mix single and double quotes to achieve: print '\t\t\t\n' % \ (number, name, seconds // 60, seconds % 60) which IMHO is much easier to re

Re: property, how to use it?

2005-05-13 Thread Larry Bates
s=-1 # # Other attributes work just fine # a.yyy=10 Larry Bates Steve wrote: > Hi, > > Read this: > http://www.python.org/2.2.3/descrintro.html#property > > If you still don't understand or are confused about it's usage, ask here. > > Hint: Sup

Re: abut COM using PythonCOM

2005-05-16 Thread Larry Bates
Yes code can be compiled with py2exe. I then use Inno Installer to create single setup.exe file that installs everything and registers it for use. Larry Bates flyaflya wrote: > I know using ActivePython can make a COM easily,but I wander how to > distribute the COM,normal COM can be ins

Re: Problem listing services with wmi

2005-05-16 Thread Larry Bates
Might not be the problem but try without the leading spaces before your method calls. for s in c.Win32_Service (): should be for s in c.Win32_Service(): -Larry Jean-Sébastien Guay wrote: > Hello, > > I'm pretty new to Python, though I have a fair bit of experience with >

Re: Problem listing services with wmi

2005-05-16 Thread Larry Bates
am (1)". Always write this as "spam(1)". -Larry Jean-Sébastien Guay wrote: > Hello Larry, > >> Might not be the problem but try without the leading >> spaces before your method calls. >> >> for s in c.Win32_Service (): >> >> should be

Re: Sorting x lists based on one list ... maybe an example would make sense:

2005-05-17 Thread Larry Bates
Why not merge the lists together using zip() and then sort. info=zip(l1, l2, l3) info.sort() info.reverse Larry Bates Philippe C. Martin wrote: > l1 = ['a','b','c'] > l2 = ['toto','titi','tata'] # 'toto' refe

Re: command to update a web page

2005-05-17 Thread Larry Bates
have your php web page access that information every time it refreshes. The database would need to be hosted at the website (but most ISPs now give you free MySQL anyway). Sort of depends on how often this happens, how complex the php page is, etc. as to which is best method. Larry Bates [EMAIL

Re: Plone personalization

2005-05-18 Thread Larry Bates
Plone/Zope does support the environment you describe. Viacom uses Zope (and I think Plone) to provide their live video streaming from their site. Since Plone/Zope are free you can download and test to your heart's desire. Larry Bates [EMAIL PROTECTED] wrote: > I'm conducting

Re: What are com_record objects

2005-05-18 Thread Larry Bates
Python does have struct module that allows you to create C-style structures. Googling for "python struct" give us: http://docs.python.org/lib/module-struct.html I use it a lot to interface to COM object and to call methods in .DLLs. Larry Bates Gijs Korremans wrote: > Hi, &

Re: Is Python suitable for a huge, enterprise size app?

2005-05-18 Thread Larry Bates
tail about application). Even if you don't want to use all of Zope the ZODB is a well tested persistent Python object store that might prove helpful. There are many other projects supporting WAY more than 200 users that are written in Python. -Larry Bates john67 wrote: > The company I work for is

Re: performance of Nested for loops

2005-05-20 Thread Larry Bates
code optimization. Larry Bates [EMAIL PROTECTED] wrote: > Is there a better way to code nested for loops as far as performance is > concerned. > > what better way can we write to improve the speed. > for example: > N=1 > for i in range(N): >for j in range(N): >

Re: slow sql server DB reads

2005-05-24 Thread Larry Bates
s probably elsewhere. If there are many, indexing on GUID would provide speed improvement. Larry Bates bart wrote: > I run a python website on a IIS server. I replaced my flat file DB > with SQL server, but the reads are very slow. 7 seconds for 3 querrys > like these > > conn= ad

Re: can't see timer in emacs action

2005-05-25 Thread Larry Bates
I don't know about emacs, but this works in PythoWin IDE. import time import sys for i in range(20): sys.stdout.write(str(i)+' ') sys.stdout.flush() time.sleep(1) -Larry [EMAIL PROTECTED] wrote: > Hello, > > I tried this code in emacs. > for i in

Re: converting jpg to pdf

2005-05-26 Thread Larry Bates
You use PIL (Python Imaging Library) if you want simple conversion or ReportLab if you want to combine several along with text, etc. -larry Raghul wrote: > Hi friends > Is it possible to convert jpg to pdf in python. I need a > program to convert jpg format file to pdf. Is

Re: ConfigParser, mapping one key to multiple values

2005-06-01 Thread Larry Bates
x for x in ini.options(section) if x.lower().startswith('ignore_')] ignores_list=[] for option in ignore_options: ignores_list.append(ini.get(section, option)) Larry Bates Thomas Guettler wrote: > Hi, > > I need a config like this: > > [sync

Re: SMTP help please

2005-06-07 Thread Larry Bates
I have found that the SmtpWriter class "hides" all the complexity in creating emails like you want to send. Check it out here: http://motion.sourceforge.net/related/send_jpg.py HTH, Larry Bates Syscon, Inc. Ivan Shevanski wrote: > I really can't figure out anything about the

Re: School Administration Software

2005-06-07 Thread Larry Bates
oogle turned these up quickly. Larry Bates Greg Lindstrom wrote: > Hello- > > I just picked up my daughters' report cards for the year (they did well, > thank-you) and was approached by the school administrator about writing > an Acess application to help track attendance

Re: Opening a drive folder from Python

2005-06-14 Thread Larry Bates
You should supply more information: What operating system? What do you mean by "drive folder"? Does this mean file dialog? Or perhaps you mean an Explorer Window? Larry Bates John Henry wrote: > Can somebody please tell me how to pop open a drive folder from a > Python scri

Re: FAQ: how to vary the byte offset of a field of a ctypes.Structure

2007-05-31 Thread Larry Bates
Curiously yours, thank in advance, > How about something like: class fooStruct(ctypes.Structure): _pack_ = 1 _fields_=[] def __init__(self, fields): self._fields_=fields ctypes.Structure.__init__(self) a=fooStruct([('first', 3*ctypes.c_ubyte), ('second', 4*ctypes.c_ubyte)]) print a._fields_ -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Using PIL to find separator pages

2007-06-01 Thread Larry Bates
Steve Holden wrote: > Larry Bates wrote: >> I have a project that I wanted to solicit some advice >> on from this group. I have millions of pages of scanned >> documents with each page in and individual .JPG file. >> When the documents were scanned the people tha

Re: What is equivalent of *this = that in python?

2007-06-01 Thread Larry Bates
her.__dict__) > > HTH, > Have you looked at Pyro? Maybe it would work for you. http://pyro.sourceforge.net/ -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Using PIL to find separator pages

2007-06-01 Thread Larry Bates
Steve Holden wrote: > Larry Bates wrote: >> Steve Holden wrote: >>> Larry Bates wrote: >>>> I have a project that I wanted to solicit some advice >>>> on from this group. I have millions of pages of scanned >>>> documents with each page in

Re: Where can I suggest an enchantment for Python Zip lib?

2007-06-07 Thread Larry Bates
use: maxzipbytesupperlimit=int((1L<<31)-(8*(1<<20))) That is 2Gb-8Mb maximum TOC limit of a zip file. I look at zipbytes add the uncompressed size of the next file, if it exceeds maxzipbytesupperlimit, I close the file and move to the next zip archive. If it is smaller, I add the file to the archive. Hope this helps. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: How Can I Increase the Speed of a Large Number of Date Conversions

2007-06-07 Thread Larry Bates
James T. Dennis wrote: > Some Other Guy <[EMAIL PROTECTED]> wrote: >> vdicarlo wrote: >>> I am a programming amateur and a Python newbie who needs to convert >>> about 100,000,000 strings of the form "1999-12-30" into ordinal dates >>> for sorting, comparison, and calculations. Though my script doe

<    6   7   8   9   10   11   12   13   14   15   >