Re: Return returns nothing in recursive function

2006-10-17 Thread Larry Bates
Matt, You should consider not using the long footer on posts to comp.lang.python. It doesn't make a lot of sense there. -Larry > This email is confidential and may be privileged. If you are not the intended > recipient please notify the sender immediately and delete the email from your > comp

Re: A question about list

2006-10-17 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hello: > Variable 'a' has the next values: > [[1,1],[2,2]] > and I want to take a to b as: > [[1,1,'='],[2,2,'=']] > How can I do this with only one line of instruction? > Thanks!! > To copy a list use: b=a[:] -Larry -- http://mail.python.org/mailman/listinfo/python-l

Re: A question about list

2006-10-17 Thread Larry Bates
Larry Bates wrote: > [EMAIL PROTECTED] wrote: >> Hello: >> Variable 'a' has the next values: >> [[1,1],[2,2]] >> and I want to take a to b as: >> [[1,1,'='],[2,2,'=']] >> How can I do this with only one line of instruction? >

Re: Determining if a file is locked in Windows

2006-10-18 Thread Larry Bates
> Thanks in advance > Try the copy and catch the exception instead. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting method name from within the class method

2006-10-18 Thread Larry Bates
Mitko Haralanov wrote: > I need to be able to get the name of the currently executed method > within that method. I know that the method object does have the > __name__ attribute but I know know how to access it from withing the > method. > > Something like this: > > class A: > > def a_m

Re: python module for finite element program

2006-10-20 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hello, > > Is there any add on python modules suitable for finite element 3D mesh > such as to create (beam, plate, etc) ? > > Best Regards, > ajikoe > Google is your friend: http://www.python.org/pycon/papers/pysparse.html http://sourceforge.net/projects/feval/ http

Re: FTP over SSL

2006-10-20 Thread Larry Bates
Tor Erik Soenvisen wrote: > Hi, > > Anyone know about existing code supporting FTP over SSL? > I guess pycurl http://pycurl.sourceforge.net/ could be used, but that > requires knowledge of libcurl, which I haven't. > > regards I don't know if it helps at all, but you can do https put of a file o

Re: Why doesn't this work?

2006-10-21 Thread Larry Bates
Because datetime is a new-style class: The Constructor __new__ If you are like me, then you probably always thought of the __init__ method as the Python equivalent of what is called a constructor in C++. This isn't the whole story. When an instance of a class is created, Python first calls the _

Re: _winreg.saveKey question

2006-10-23 Thread Larry Bates
is KEY_READ The result is a new handle to the specified key If the function fails, an EnvironmentError exception is raised. The default is KEY_READ so you can't update. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: _winreg.saveKey question

2006-10-23 Thread Larry Bates
is KEY_READ The result is a new handle to the specified key If the function fails, an EnvironmentError exception is raised. The default is KEY_READ so you can't update. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: The status of Python and SOAP?

2006-10-24 Thread Larry Bates
I would venture to guess that this is the one I would lean towards if I needed SOAP support: http://www.effbot.org/downloads/#elementsoap I know is says "experimental" but Fredrik Lundh's idea of experimental always seems to be everyone else's idea of a shipping product (e.g his code just seems t

Re: Sending Dictionary via Network

2006-10-24 Thread Larry Bates
mumebuhi wrote: > Hi, > > Is it possible to send a non-string object from a Python program to > another? I particularly need to send a dictionary over to the other > program. However, this is not possible using the socket object's send() > function. > > Help? > > > Buhi > You will need to pick

Re: Tracing the execution of scripts?

2006-10-27 Thread Larry Bates
I just thought I would put my 2 cents in on this issue. Others have suggested that unit tests are an excellent way of debugging your code and I agree. I also find that writing code from the outset using a logging class (there is one in the standard library) that allows you to create log files of

Re: Configfile

2006-10-27 Thread Larry Bates
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > HI, > > I've a small doubt regarding the way to save a configuration file on the file > manipulated by ConfigParser. > As far as I could understand this: > > cp = ConfigParser

Re: Python windows interactive.

2006-10-30 Thread Larry Bates
notejam wrote: > I am trying to get started with a interactive version of Python for > windows and need some help. > I have played with the tutorial, and now want to write a program. > > In basic language, I could write something like > 10 print "hello" > 20 print "Jim" > > and if I run it I woul

Re: Best way to have intermediate object description format

2006-11-03 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hi, > Is there any standard text format for storing data of object oriented > nature. > The text file should be readable. > > That is, Is there any better way than having to write out a file like > this from the original place and read it in python and process it. > >

Re: Converting Microsoft Works databases.... *shudder*

2006-11-03 Thread Larry Bates
Michael B. Trausch wrote: > I was wondering if anyone has had any experience with this. Someone I > know is trying to move away from Microsoft Works, and I am trying to > look into a solution that would convert their data in a lossless fashion > to a more modern format. The database has more than

Re: py2exe questions

2006-11-03 Thread Larry Bates
Doug Stell wrote: > I have 2 questions about py2exe or any similar utility. > > 1. Is it possible to create a single Windows executable that does not > blow out to a folder full of files and can be called from scripts > using command line arguments? > > 2. If the above can be done, it is possible

Re: Having trouble with file modes

2006-11-03 Thread Larry Bates
Don't do that. Do something like renaming the old file to .bak (or .aside or something) and then create the entire file by opening it with 'w'. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: how do I pass values between classes?

2006-11-04 Thread Larry Bates
kath wrote: > hi everyone. > > I have a task, I have fragmented the task into subtask. I have planned > to create a class to each subclass and one parent class to handle the > sub tasks. Each subclass are saved in seperate file and all my > subclasses and parent class are placed in the sam

Re: how do I pass values between classes?

2006-11-06 Thread Larry Bates
kath wrote: > hi, Larry Bates thanks for the reply... > >> You might consider doing it the same way wx passes things around. >> When you instantiate the subclass pass the parent class' instance >> as first argument to __init__ method. > > Yes thats ab

Re: auto indent

2006-11-06 Thread Larry Bates
M.N.Smadi wrote: > Hi there; > > i have a script that is not indented properly. Is there a way that i can > have it auto indented. > > thanks > moe smadi Not really. Indention in python conveys blocks so there is no way anything automatic could determine where blocks end. Its just like asking

Re: assigning values in __init__

2006-11-06 Thread Larry Bates
John Salerno wrote: > Let's say I'm making a game and I have this base class: > > class Character(object): > > def __init__(self, name, stats): > self.name = name > self.strength = stats[0] > self.dexterity = stats[1] > self.intelligence = stats[2] > se

Re: Python deployment options.

2006-11-08 Thread Larry Bates
king kikapu wrote: > I see...So, if these are the only options, the only "safe" bet is to > install the language on the machine (beeing Win, Linux or Mac) > and execute the .py files, right ?? > > > On Nov 8, 1:24 pm, "Chris_147" <[EMAIL PROTECTED]> wrote: >> king kikapu wrote: >>> Hi to all folk

Re: help using smtplib to work ..

2006-11-08 Thread Larry Bates
NicolasG wrote: > I'm using the following code to send e-mail through python: > > import smtplib > > fromaddr = '[EMAIL PROTECTED]' > toaddrs = '[EMAIL PROTECTED]' > subject = 'someting for subject !' > > msg = 'This is body of the mail.' > > msg = 'From: ' + fromaddr + '\nTo: ' + toaddrs + '\

Re: Python v PHP: fair comparison?

2006-11-14 Thread Larry Bates
walterbyrd wrote: > I don't know if this is a fair comparison or not. Any comments > appreciated. > > - Python is more readable, and more general purpose > - PHP has awful backward compatibility > - PHP has a lower barrier to entry > - Most inexpensive web-hosters support PHP, but not Python > - P

Re: How to make a python file to a DLL?

2006-11-16 Thread Larry Bates
many_years_after wrote: > Any solution? > > Thanks. > You can certainly make python program/function into a COM object which can be called from other languages quite easily and I think is the more preferred method in newer software. py2exe has examples of creating COM objects. -Larry -- http:/

Re: Are ActivePython scripts compatible with Linux?

2006-05-31 Thread Larry Bates
Short answer: yes Things to watch out for: 1) Versions on both Windows/Linux need to be compatible. If Linux has same or later version, you are normally OK. If Linux version is older, you will have to use only Python Libraries and functions that are in the oldest version. 2) Don't use OS-speci

Re: Help requested -- importing stuff from a .COM DLL into python

2006-05-31 Thread Larry Bates
es. Maybe you can call via COM, but I just haven't ever done that. You should be able to use ctypes to interface to them. The "tricky" part is passing data back and forth. Building the proper data structures in Python can take some work. You should take a look at ctypes from: http://sourceforge.net/project/showfiles.php?group_id=71702 COM sample is here: http://starship.python.net/crew/theller/ctypes/sum_sample.html HTH, Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to do data source abstraction

2006-06-01 Thread Larry Bates
nt "Name", obj.name print "Address1", obj.address1 print "Address2", obj.address2 print "City", obj.city print "State...", obj.state print "Zip.", obj.zip -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Open Source Charting Tool

2006-06-02 Thread Larry Bates
ReportLab Graphics can do 2D and pie charts, but I don't think it does 3D charts yet. www.reporlab.org Larry Bates A.M wrote: > Hi, > > > > I developed a HTML reporting tool that renders Oracle data to HTML and > Oracle. > > > > At this point I have to

Re: Open Source Charting Tool

2006-06-02 Thread Larry Bates
Ouch. I had a typo. -Larry Scott David Daniels wrote: > Felipe Almeida Lessa wrote: >> Em Sex, 2006-06-02 às 16:56 -0400, A.M escreveu: >>> I can't browse to www.reporlab.org, but I found >>> http://www.reportlab.com/ which has a commercial charting product. >>> Is that what you referring to? >

Re: Instead of saving text files i need as html

2006-06-08 Thread Larry Bates
Then just write HTML around your list. I would guess you want them inside a table. Just write appropriate HTML tags before/after the urls. If you want the URLs to be clickable make them in into url lines. -Larry Bates Shani wrote: > I have the following code which takes a list of urls >

Re: cos: "Integer Required"?!?!?!?

2006-06-08 Thread Larry Bates
First: Always post cut-paste tracebacks so we can see actual error message. Second: print out self.ACphi, XPLMGetDataf(self.ACphi) and math.radians(XPLMGetDataf(self.ACphi)) before this statement and you will find the problem. -Larry Bates moonman wrote: > Hello all, > > I've ju

Re: Python or Ajax?

2006-06-09 Thread Larry Bates
verts client portions to Javascript (if I'm understanding how it works). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: First question on extending Python...

2006-06-09 Thread Larry Bates
asses that help with the C structures that need to be passed back and forth. For that you will probably also need to take a look at the Python struct module, but ctypes has some built-in helper functions also. ctypes can be located here: http://starship.python.net/crew/theller/ctypes/ -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: "parent" in a class __init__ def?

2006-06-10 Thread Larry Bates
ts deeper and deeper into the class hierarchy. It can simplify the argument lists quite a bit. Maybe others can comment with their thoughts as well. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting "TypeError:list indices must be integers"

2006-06-13 Thread Larry Bates
ecuted because i'm stuck on that TypeError since 2 hours > :( (2) You have the weirdest system of choosing names that I have seen for >> decades. > :(( >> (3) Both of the above. >> >> Cheers, >> John >> > How about just inserting some pri

Re: DispatchEx('.Application')

2006-06-13 Thread Larry Bates
I intend to do this: > > mf.Navigate('www.groups.google.com.au/etc'') > > Will all of these functions work with Firefox or is it only Internet > Explorer(I can use either but I prefer Firefox?) > This might help: http://mail.python.org/pipermail/python-win32/2005-June/003413.html -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Database read and write

2006-06-15 Thread Larry Bates
Might want to check out: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715 -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in Windows ng

2006-06-15 Thread Larry Bates
k Hammond and Andy Robinson). It covers lots of Windows "specific" things and has good examples of writing services and COM objects. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: a good programming text editor (not IDE)

2006-06-15 Thread Larry Bates
edge of Java? Or am I being even > more newbie-ish than I thought I was? :) Nope, no Java knowledge necessary. Jython just compiles Python code to java bytecode instead of python bytecode. Once it is in java bytecode the JVM doesn't know where it came from. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: copyfile avoiding overwrites and race conditions

2006-06-19 Thread Larry Bates
d it, extract next filename, increment the counter portion of the filename, write it back out and unlock it. Now I have the name of the file to write that is unique to my instance and I can write it without worrying about other processes. Hope this helps. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Running Python modules dump stuff on "C" drive?

2006-06-19 Thread Larry Bates
Warren wrote: > I am running win2k pro and was wondering if writing python scripts or > running modules dumps anything in the "C" drive? I have 3 partitions > and run python on the 3rd one or "E"drive. > My "C" drive is almost full and keeps loading up with stuff I don't > want or need. Some of i

Re: pyExcelerator - Can I read and modify an existing Excel-WorkBook?

2006-07-11 Thread Larry Bates
; Greetings, > Marco > > If you are on Windows, you may find using COM interface to actual Excel application easier. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: os.access() problem

2006-07-11 Thread Larry Bates
sions, so I could be missing something simple. Can anyone offer > any suggestions? > > Thanks, > Phil > I just tested on Windows XP with ActiveState Python 2.4.1 and it works as expected. >>> import os >>> os.access(r'c:\output.txt', os.W_OK) True Ch

Re: Taking data from a text file to parse html page

2006-08-24 Thread Larry Bates
th blank space) I'm new to python > and could use a little push in the right direction, any ideas on how to > implement this? > > Thanks! > See Beautiful Soup: http://www.crummy.com/software/BeautifulSoup/ it will parse even badly formed HTML and allow you to extract/ch

Re: Accessing application data portably

2006-08-24 Thread Larry Bates
Tom E H wrote: > Larry Bates wrote: >>> Well that's great, but how do you access the ini file portably? >> From my original post: >> >> Then I use ConfigParser in my application... > > Thanks, but where in the directory structure do you put the ini file

Re: lambda

2006-08-24 Thread Larry Bates
fegge wrote: > what is a lambda expression? > You really should try Google first (python lambda): http://www.secnetix.de/~olli/Python/lambda_functions.hawk http://diveintopython.org/power_of_introspection/lambda_functions.html -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Python editor

2006-08-24 Thread Larry Bates
lug-in). These represent both ends of the spectrum in editors. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: List problem

2006-08-24 Thread Larry Bates
typed: list[0]+['Five'] that gives you the error you showed. What you meant to type was: l = ['One','Two','Three','Four'] This is a list of four strings, what you entered was a list of one string. NOTE never call a variable 'list' as it will mask the built-in list method (same goes for str, tuple, int, float, etc). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating an executable installer on Windows

2006-08-25 Thread Larry Bates
info.php) to create the actual Windows installer (e.g. setup.exe). This does what you want and was very easy to set up. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: [Q] About an Installer Script for PyWin

2006-08-25 Thread Larry Bates
mputers (Compaq/HP) as some of their management software is written in Python. So "power-users" need to be pretty careful removing it these days. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: block a network port

2006-08-29 Thread Larry Bates
uestion. Blocking ports is a function of your firewall solution. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for Windows

2006-08-30 Thread Larry Bates
; Python code, it is an interpreted language. You can use an extension called py2exe that packages up python code with a .exe file and a couple of support files and that package can be installed on a computer with minimal or no registry or system file modifications. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: where or filter on list

2006-08-30 Thread Larry Bates
ered you can break out of the loop you can optimize the loop by breaking out when you start getting further away from value or you might be able to use the bisect module to find it faster. If the lists are small it probably isn't worth the extra effort. If they are large and sorted look at

Re: Python for Windows

2006-08-30 Thread Larry Bates
mistral wrote: > hg писал(а): > >> Grant Edwards wrote: >> Will the msi installer modify registry or other system files? Does it possible install Python not touching registry and system files? >> You can make your own installer to install Python, and make sure the >> registry is not

Re: where or filter on list

2006-09-01 Thread Larry Bates
What I mean is: What if there are two items that are equidistant to what you are searching for? Example: foo = [-5,-1,1,3,5] print closest(0, foo) -1 and 1 are both "equally close" to zero that I'm searching for. This is an edge case that you didn't define an answer to and closest function tha

Re: Python for Windows

2006-09-01 Thread Larry Bates
mistral wrote: > Larry Bates писал(а): > >> mistral wrote: >>> hg писал(а): > >>>> Grant Edwards wrote: > >>>>>> Will the msi installer modify registry or other system files? >>>>>> Does it possible install Pytho

Re: IronPython 1.0 - Bugs or Features?

2006-09-06 Thread Larry Bates
try: block, it then executed what was in the except: block. Since all that was in the except: block was pass, it just fell through to the if statement. At that point strData is not defined because the try block failed and never create strData object. It is doing EXACTLY what you told it to do. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Secure Postgres access

2006-09-06 Thread Larry Bates
ote machine. Works great and the traffic is encrypted and I know who the user is because they can't connect until they give me their pubkey and I put on the server and they must have their private key AND passphrase to establish the SSH connection. I use this to run pgAdmin III remotely through a firewall to my database server. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Data sticking around too long

2006-09-06 Thread Larry Bates
much easier to > work with. > > Thanks again! > > Rob Richardson > RAD-CON, Inc. > Bay Village, OH > You shadowed the class attribute scanList by creating an instance variable called self.scanList in the __init__ method: self.scanList = [] Comment that line out and see what you get. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Larry Bates
oing what you told it to. print "hello program" and exit (which closes the window). If you want it to pause put something after the print like: t=raw_input('Hit return to continue') This way the program will pause until you hit return. Good luck. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Larry Bates
Omar wrote: > thank you genteman. > > however, its not working :( > > I resaved it, but same thing. > Please post some code so we can actually do something more than read your mind. You can also run the program from a shell instead of from idle to see what happens. -La

Re: should urlparse return user and pass in separate components?

2006-09-07 Thread Larry Bates
not None: port=int(port) return [scheme, domain, username, password, rootfolder, port] -Larry Bates metaperl wrote: > The urlparse with Python 2.4.3 includes the user and pass in the site > aspect of its parse: > >>>> scheme, site, path, parms, query, fid = >>

Re: split string problems

2006-09-08 Thread Larry Bates
Tempo wrote: > Hey. I am trying to grab the prices from the string below but I get a > few errors when I try to do it: Take a look at the code and error > messages below for me and thanks you in advanced to all that help. > Thank you. Here's the code & error messages: > p > [ >

Re: PILGraph Upgrade or Alternative Suggestion

2006-09-08 Thread Larry Bates
with titles and legends. I do need multi-platform for both Linux and > Windows. The intended use is to create graphics for web pages on the fly. > > TIA, > > Roger ReportLab Graphics works pretty well for me. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: win32service (wxpython) -- i cannot install service

2006-09-11 Thread Larry Bates
ndows services. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: extracting substrings from a file

2006-09-11 Thread Larry Bates
re interested in keeping. I am assuming that /GEN= and /gb: data doesn't have any spaces in them. If they do, you will need to use regular expressions instead of split. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: inserting into a file

2006-09-11 Thread Larry Bates
pondingly. > > Is there any other way to do this? > Please help... > > Sai krishna M No "magic" way to insert lines. If file is small, read into memory, insert line, write to disk. If it is large, read and write lines to secondary file, insert line, read remaining lines, dele

Re: best small database?

2006-09-11 Thread Larry Bates
t place to store files, not as blobs in a database. The answer about which database depends on your target platform but you could consider gadfly. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: A cross platform systray icon

2006-09-11 Thread Larry Bates
Nick Craig-Wood wrote: > Does anyone have some hints / tips / experience with making a cross > platform systray icon? It should work on Windows, Gnome and KDE at > minimum. > > I've seen the win32all code which is very similar to the C code I've > written before for Windows. It would be a small

Re: auto upgrade scripts?

2006-09-11 Thread Larry Bates
t; Best regards, > Stefaan. > Auto-upgrade from what to what? -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: best small database?

2006-09-11 Thread Larry Bates
Blair P. Houghton wrote: > Larry Bates wrote: >> The filesystem is almost always the >> most efficient place to store files, not as blobs in a >> database. > > I could get all theoretical about why that's not so in most cases, > but there are plenty of cases

Re: best small database?

2006-09-12 Thread Larry Bates
Paul Rubin wrote: > Larry Bates <[EMAIL PROTECTED]> writes: >> As far as "rational extension" is concerned, I think I can relate. >> As a developer of imaging systems that store multiple-millions of >> scanned pieces of paper online for customers, I can pr

Re: auto upgrade scripts?

2006-09-13 Thread Larry Bates
[EMAIL PROTECTED] wrote: >> Auto-upgrade from what to what? >> -Larry Bates > > Interesting question. > > In my case I want my program to check for (e.g.) bug-fix releases on > some location (network drive or ftp), and if available, allow to > automatically downlo

Re: win32service (wxpython) -- i cannot install service

2006-09-13 Thread Larry Bates
kkt49 wrote: > under code service install => ok > > _svc_name_ = r'moin_service' > _svc_display_name_ = r'moin_service' > start_cmd = r"c:\mmde\moin.exe" > #info = ['', '', ''] > > def __init__(self): > #self._svc_name = info[0] > #self._svc_display_name_ = inf

Re: win32service (wxpython) -- i cannot install service

2006-09-13 Thread Larry Bates
Larry Bates wrote: > kkt49 wrote: >> under code service install => ok >> >> _svc_name_ = r'moin_service' >> _svc_display_name_ = r'moin_service' >> start_cmd = r"c:\mmde\moin.exe" >> #info = ['

Re: stock quotes

2006-09-13 Thread Larry Bates
Donlingerfelt wrote: > I would like to download stock quotes from the web, store them, do > calculations and sort the results. However I am fairly new and don't have a > clue how to parse the results of a web page download. I can get to the > site, but do not know how to request the certain data

Re: Help

2006-09-18 Thread Larry Bates
Ascher Python programming on Win 32 by Mark Hammond & Andy Robinson -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: win32 Service: path to .py script

2006-09-19 Thread Larry Bates
uld not have a drive mapping Y:\. You can change the account that a service runs under in the Service Manager-Log On tab. Normally you wouldn't run services from mapped drives, they would be installed on local machine and started from there. If services need to access mapped drives, you need to put full UNC pathnames to access them or run the services under an account that has the drives mapped properly. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: new string method in 2.5 (partition)

2006-09-19 Thread Larry Bates
endswith() string methods that are > new and seem neat as well. FYI- .startswith() and .endswith() string methods aren't new in 2.5. They have been around since at least 2.3. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace single character at given position

2006-09-19 Thread Larry Bates
> > Thanks in advance, > Martin > > > You can do this: s1=s1.replace('x','y', 1) # Only replace the first x with y or s1l=list(s1) s1l[1]='y' s1=''.join(s1l) or your method of using slices. All depends on what you want to do. Quite often you use .replace() method so you don't have to worry with the index. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: include statement

2006-09-20 Thread Larry Bates
Python's syntax. If someone gets something wrong in a file that gets included, it is harder to take a sane default or handle the error than with ConfigParser. Just a suggestion that I hope helps. -Larry Bates or -- http://mail.python.org/mailman/listinfo/python-list

Re: Using py2exe to wrap a service?

2006-09-20 Thread Larry Bates
=[myservice] > ) > > 'elp! Plz! > You may want to post this on gmane.comp.python.py2exe also. I'm going to try to guess what the problem is, but it is a little hard to tell from here. py2exe does its best to find all the modules required to create the .exe. Sometimes modules do dynamic imports, etc. of modules that "fool" py2exe. I'm guessing that this is the case and that you will need to manually include the missing module. Most such errors seem to fall into this category. Hope this at least points you in the correct direction. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to run an external program

2006-09-21 Thread Larry Bates
on, but on a more general note: If you want directory information use os.listdir or glob.glob instead. No reason to shell out to do a dir. If you were using dir as an example, please disregard. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Larry Bates
e when > I want it to stop, and can reload the data and continue to run from > where it stops when the computer is free ? > > Regards, > > xiaojf > You can save the state of Python objects and reload them at a later time/date by using Zope's ZODB. http://www.z

Re: Replacing line in a text file

2006-09-25 Thread Larry Bates
= yes'.join(data.split('disable = no',1)) fp=open(filename, 'w') fp.write(data) fp.close() -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Deprecation in String.joinfields()

2006-09-25 Thread Larry Bates
lds' > >>>> newname1 = string.join (li[:-1], ".") >>>> newname1 > 'a.b.mpilgrim.z' >>>> newname = li[:-1].joinfields(".") > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'list' object has no attribute 'join' > > Thank you for your help > > Anoop > I think you want: newname1='.'.join(li[:-1]) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: ultra newbie question (don't laugh)

2006-09-26 Thread Larry Bates
cond nature to think of creating/using objects in places where you want to provide for maximum flexibility and code isolation. At a minimum you should take a look at the elementtree module for handling your XML. It is downloadable for Python < 2.5 and is part of the standard library starting with version 2.5. Hope information helps at least a little. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: problem moving from char to integer

2006-09-26 Thread Larry Bates
You should also lose the semicolons, you are writing Python now, not PHP ;-). You might also want to write: def strord(url): return [int(i) for i in url] Or just lose the function completely since it degrades to a single list comprehension. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: productivity and long computing delays

2006-09-27 Thread Larry Bates
uessing - A significant portion of the time might be I/O that is disk bound so faster CPU won't help. If that's the case faster hard drive (10K or even 15K rpm) or a striped drive array could help. You should also check memory, if CPU starts swapping, the swap I/O will kill your performance. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: XSLT speed comparisons

2006-09-28 Thread Larry Bates
Damian wrote: > Hi, I'm from an ASP.NET background an am considering making the switch > to Python. I decided to develop my next project in tandem to test the > waters and everything is working well, loving the language, etc. > > What I've got is: > two websites, one in ASP.NET v2 and one in Pytho

Re: XSLT speed comparisons

2006-09-28 Thread Larry Bates
Jan Dries wrote: > Larry Bates wrote: >> Damian wrote: > [...] >> > What I've got is: >> > two websites, one in ASP.NET v2 and one in Python 2.5 (using 4suite for >> > XML/XSLT) >> > both on the same box (Windows Server 2003) >> > bo

Re: Best way to handle large lists?

2006-10-03 Thread Larry Bates
Chaz Ginger wrote: > I have a system that has a few lists that are very large (thousands or > tens of thousands of entries) and some that are rather small. Many times > I have to produce the difference between a large list and a small one, > without destroying the integrity of either list. I was wo

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Larry Bates
sn't seem to work.. > > Thanks in advance. > The answer is don't pass any value. print f() will print 2 -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: [Zopyrus] A python IDE for teaching that supports cyrillic i/o

2006-11-18 Thread Larry Bates
Oleg Broytmann wrote: > On Sat, Nov 18, 2006 at 09:01:04PM +0200, Kirill Simonov wrote: >> Could anyone suggest me a simple IDE suitable for teaching Python as a >> first programming language to high school students? > >Does it have to be an IDE? Wouldn't it be better to use a simple text > ed

Re: python skipping lines?

2006-11-27 Thread Larry Bates
[EMAIL PROTECTED] wrote: > thats easy enough to solve > > """test text.py > for playing around with my text editing task > """ > > UnitList = open('/Python25/working/FacList.txt', 'r') > RawData = open('/Python25/working/data.txt', 'r') > Output = open('/Python25/working/output.txt', 'a') > > de

Re: SPE (Stani's Python Editor) web site?

2006-11-28 Thread Larry Bates
John DeRosa wrote: > SPE's site (http://pythonide.stani.be/) has been inaccessible to me > for at least a day. Can anyone else get to it? > > I looked on Google and didn't see any new locations for SPE. Has it > recently moved to somewhere else? I dimly recall a post by Stani > wherein he said

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Larry Bates
Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full blown > parsing module. My simple script works well until it run

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