Re: Calling J from Python

2007-02-05 Thread Larry Bates
ould care? > > Regards, > > > Björn > And why is that superior to this: def avg(l): return float(sum(l))/len(l) >>>avg([1,2,3,4]) 2.5 Which can actually be read and debugged in the future! -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: alias for data member of class instance?

2007-02-05 Thread Larry Bates
usty.y >>> 1 > > ... ? thanks. > > peace > stm > Not sure why you want it, but here is one solution: class clown: def __init__(self): self.x=0 def __getattr__(self, key): if key == 'y': return self.x return self.__dict__[key] -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: huge amounts of pure Python code broken by Python 2.5?

2007-02-06 Thread Larry Bates
t; > Steve I can't think of any of my code that got broken and it fixed a broken SSL problem (on Windows) that I was fighting. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: string.find for case insensitive search

2007-02-07 Thread Larry Bates
=x.upper().find('SEARCH') print hasword True print location 23 -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: interacting with shell - another newbie question

2007-02-09 Thread Larry Bates
e that you should be able to modify easily to meet your needs. http://docs.python.org/lib/telnet-example.html -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: A little more advanced for loop

2007-02-09 Thread Larry Bates
ok at itertools izip. zip creates a list of lists which could take lots of memory/time if they are VERY large. itertools izip iterates over them in place. from itertools import izip for a_item, b_item, c_item in izip(a,b,c): # do something -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Matching Strings

2007-02-09 Thread Larry Bates
; but the output's the same. > > Rich Use the interpreter to test things: a="(u'ground water',)" a[2:-2] "'ground water'" a[3:-3] 'ground water' That is what you are looking for. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: favourite editor

2007-02-12 Thread Larry Bates
almost always interfere in some way with the editors (same was true for ActiveState). Maybe you could give that a try. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: can't find a way to display and print pdf through python.

2007-02-12 Thread Larry Bates
st let the registered .PDF viewer do it for you. os.start('myfile.pdf') Launches whatever is registered as .PDF viewer and user can then print, save, zoom, etc. on their own. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: New Pythin user looking foe some good examples to study

2007-02-12 Thread Larry Bates
plications? > > > > I would appreciate any help. > > > > Also, does anyone know of any good Linux or python user groups in the orange > county, California area? > > Pick up a copy of "Python Cookbook" from O'Reilly. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: can't find a way to display and print pdf through python.

2007-02-12 Thread Larry Bates
Grant Edwards wrote: > On 2007-02-12, Larry Bates <[EMAIL PROTECTED]> wrote: > >>> I at least need the code for useing some library for >>> connecting to acrobat reader and giving the print command on >>> windows and some thing similar on ubuntu linux. >

Re: can't find a way to display and print pdf through python.

2007-02-12 Thread Larry Bates
Grant Edwards wrote: > On 2007-02-12, Larry Bates <[EMAIL PROTECTED]> wrote: >> On 2007-02-12, Larry Bates <[EMAIL PROTECTED]> wrote: >>>>> I at least need the code for useing some library for >>>>> connecting to acrobat reader and giving the pr

Re: Does anyone have the db_row module compiled for python 2.4 on windows?

2007-02-12 Thread Larry Bates
vj wrote: > Would really appreciate the binary files for the db_row. > > Thanks, > > VJ > If you don't get an answer you may want to take a look at replacing with SQLObject: http://sqlobject.org/ -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: _ssl.pyd is buggy?

2007-02-13 Thread Larry Bates
ep(5) >servicemanager.LogMsg( >servicemanager.EVENTLOG_INFORMATION_TYPE, >servicemanager.PYS_SERVICE_STOPPED, >(self._svc_name_, "") >) >self.logger.info("Stopped") >except: >self.logger.error('',exc_info = sys.exc_info()) > > > if __name__=='__main__': >win32serviceutil.HandleCommandLine(Service) > > I was using _ssl.pyd to upload files to DAV server over ssl and found it to be a problem. I upgraded to Python 2.5 and the problem was fixed. I don't know if it is the same problem that is affecting you, but I couldn't get it to work on 2.4. FYI, Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: _ssl.pyd is buggy?

2007-02-13 Thread Larry Bates
pass #--End while-- #----- # Log stopped message to EventLog #- servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STOPPED, (self._svc_name_, '')) return Note: I pieced this together from a working service, it has NOT been tested. It should be VERY close. If you don't have it already you might want to pick up a copy of Python Programming on Win32 by Mark Hammond and Andy Robinson. It helped me a LOT. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Urllib2 and timeouts

2007-02-14 Thread Larry Bates
exception and continue your loop. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: list of range of floats

2007-02-14 Thread Larry Bates
work: flts=[float(i) for i in range(1, 11)] If you want arbitrary starting and ending floats and an arbitrary step, you will need to write your own function. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Larry Bates
27;m somewhat new to python but this makes sense to me. > finally: block is executed even if there is an exception in which case f hasn't been defined. What you want is: try: f = file(self.filename, 'rb') f.seek(DATA_OFFSET) self.__data = f.read(DATA_S

Re: Python code to do the *server* side of digest authentication?

2007-02-15 Thread Larry Bates
web server does the authentication on the server side. Why not use Apache to do the digest authentication? http://httpd.apache.org/docs/2.0/mod/mod_auth_digest.html -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: why I don't like range/xrange

2007-02-16 Thread Larry Bates
stdazi wrote: > Hello! > > Many times I was suggested to use xrange and range instead of the > while constructs, and indeed, they are quite more elegant - but, after > calculating the overhead (and losen flexibility) when working with > range/xrange, and while loops, you get to the conclusion that

Re: Sorting directory contents

2007-02-20 Thread Larry Bates
stat(x).st_mtime, x) for x in files] # # Sort them. Sort will sort on mtime, then on filename # flist.sort() # # Extract a list of the filenames only and return it # return [x[1] for x in flist] # # or if you only want the basenames of the files # #return [os.path.basename(x[1]) for x in flist] -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: setup.py installation and module search path

2007-02-20 Thread Larry Bates
t priviledge? Then what is supposed to > happen? Can anyone give me a clue? Thanks. > I'm no expert, but I think what normally happens is the module gets installed into ../pythonxx/lib/site-packages/ and if it installs __init__.py file there they get automatically searched. At least tha

Re: Convert to binary and convert back to strings

2007-02-21 Thread Larry Bates
ot;Hex: ", hex print "Len(hex):", len(hex) nonhex=HexTostr(hex) #testStr = tinycode(keyStr, etestStr, reverse=True) testStr = tinycode(keyStr, nonhex, reverse=True) print "Decrypted string:", testStr WARNING: THIS IS NOT A STRONG ENCRYPTION ALGORITHM. It is just a nuisance for someone that really wants to decrypt the string. But it might work for your application. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: jython import search path

2007-02-21 Thread Larry Bates
ell > Jython where to search for imported modules? Thanks. > Maybe Jython expert has the perfect answer but til then. Did you try: sys.path.append('path to search') Usually this works if nothing else does. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading mails from Outlook

2007-02-22 Thread Larry Bates
s. > > Can anyone help me? > > Regards, > > Sam > I'll bet that some of the best information you can get about interacting with Outlook is going to be by looking at the sourcecode to SpamBayes plug-in. You can get it from here: https://sourceforge.net/project/s

Re: How to test whether a host is reachable?

2007-02-22 Thread Larry Bates
x27;t mean you could do anything with the machine. I assume that you are connecting to do something on the machine. Just wrap what you are trying to do in try: block. It will either succeed or fail. Handle the exeption. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: paths in modules

2007-02-22 Thread Larry Bates
27;t found in my searches so far. If so, I will humbly accept > any ridicule that comes along with said simple solution :-). > > Thanks in advance, > Brandon Normally this would be: f = os.popen('./wrapper_dir/utility_dir/some_external_utility') -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread Larry Bates
a) Convert integer to ascii string: a=1 b=str(a) or a=1 b="%i" % a -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: export an array of floats to python

2007-02-22 Thread Larry Bates
ects, there is no documentation about > what to do with them :( > > Thanks for your help! I've always used the struct module to unpack the C array into the floats (or ints or strings or ...) that I wanted. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread Larry Bates
vice > versa >> in Python? >> >> Thanks! >> >> > > The phrasing of your question threw us all. What you want is chr backslash=chr(92) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding non ascii characters in a set of files

2007-02-23 Thread Larry Bates
UnicodeDecodeError: > print "file.py contains non-ascii characters" > > The next problem will be that non-text files will contain non-ASCII characters (bytes). The other 'issue' is that OP didn't say how large the files were, so .read() might be a problem. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Rational numbers

2007-02-23 Thread Larry Bates
; > P.S. The respective mailing list does not like me, so that I try my > luck here. I quick search of Google turned up: http://books.google.com/books?id=1Shx_VXS6ioC&pg=PA625&lpg=PA625&dq=python+rational+number+library&source=web&ots=BA8_4EXdQ4&sig=aDEnYA99ssKe7PSweVNyi8cS2eg http://calcrpnpy.sourceforge.net/clnum.html http://gmpy.sourceforge.net/ -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: How to build Hierarchies of dict's? (Prototypes in Python?)

2007-02-23 Thread Larry Bates
the idea of prototype associated with it for no clear reason). What you describe is exactly how Zope works so you might want to spend some time looking at it. http://www.zope.org -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Having multiple instances of a single application start a single instance of another one

2007-02-23 Thread Larry Bates
ommunication (via sockets, pipes, filesystem, database, ...). That way your A's won't have the problem you describe. Just a suggestion. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: convert python scripts to exe file

2007-02-26 Thread Larry Bates
cause you need mscvr71.dll and w9xpopen.exe at a minimum as external files. If you want to have only 1 .EXE to distribute, use Inno Installer. Your users will thank you for having a proper installer, uninstaller. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: NetUseAdd mystery

2007-02-26 Thread Larry Bates
the last 2 > hours??...) > > > Thanks for a any enlightenment... > I think your problem is that C$ is a "special" share. Try creating a share and connect to it instead. It is either that your your userid/ password are in fact incorrect. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: getting info on remote files

2007-02-26 Thread Larry Bates
scp file to local computer > 3. make sure file size of copy and original are the same > > any suggestions would be appreciated > > thanks > gabe > Why not just use rsync across the ssh tunnel to synchronize the remote file to local file? This works great and you don't have to do much. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: design question: no new attributes

2007-02-26 Thread Larry Bates
"Pythonic design" is not to worry about it. If users want to set attributes that won't accomplish anything productive (within your class) let them. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: how can I create/set a 'file' reference in a attribute of a class

2007-02-26 Thread Larry Bates
def __init__(self, fp=None): self.fp=fp def endElement(self, name: doSomething(self, "GroupResultList", self.text, self.fp) but you could set it later if you like: fp = open('dummyFile.txt') curHandler=LogHander() curHandler.fp=fp -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: import parent

2007-02-27 Thread Larry Bates
list class foo: def __init__(self): self.somelist=['a','b','c'] self.bars=[] self.bars.append(bar(self)) At least that's the way I understand it and it seems to work. If this isn't what you are asking just disregard. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: database without installation again

2007-02-27 Thread Larry Bates
llows you: MySQL databases root access to your virtual machine By the time you do the research and/or write something you will have spent more time than moving to another ISP. Its not all that hard and they are CHEAP. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Eric on XP for Newbie

2007-03-01 Thread Larry Bates
int me to a > simple step by step guide for installing Eric? I've downloaded the tar > files, but what do I do with them? > > Thanks > Take a look at PyScripter also. I REALLY like it a lot on Windows: http://mmm-experts.com/Products.aspx?ProductId=4 -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE

2007-11-02 Thread Larry Bates
rom it. Lots of discussions on this have been posted try looking into history of this list. Everything from vi to Eclipse to Wing. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: zipfile handling

2007-11-07 Thread Larry Bates
s that you go through the process to get a proper zip file. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Binary search tree

2007-11-09 Thread Larry Bates
le to check if the URL already exist. > > Couldn't find any python library that implements trees. > Is there some library of this kind in python? Or can I find it > somewhere else? > Put them into a set. You can check for existence (very fast) and at the end it is easy to sort. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: wx.listctrl- insertstringitem not working

2007-11-09 Thread Larry Bates
for i in range(num): > self.list.CheckItem(i) > > def OnDeselectAll(self, event): > num = self.list.GetItemCount() > for i in range(num): > self.list.CheckItem(i, False) > > def OnApply(self, event): > num = self.list.GetItemCount() > for i in range(num): > if i == 0: self.log.Clear() > if self.list.IsChecked(i): > self.log.AppendText(self.list.GetItemText(i) + '\n') > > app = wx.App() > Repository(None, -1, 'Repository') > app.MainLoop() > > > > If you see what I'm doing wrong I'd be grateful for any help. > > Mike > You probably will want to post over at gmane.comp.python.wxpython. A lot more wx people (including wxPython author) over there. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving from java to python.

2007-11-12 Thread Larry Bates
ith using [] as default arguments. Mutables are only evaluated once (not at every call). This question comes up about once a week on this forum where people don't understand this. I would recommend using (if you can): def __init__(self, connected = None, weights=None, uid = None): self.connected = connected or [] self.weights = weights or [] If you want to stay with single connections list do this: def __init__(self, connections = None, uid = None): if connections is not None: self.connected=[c[0] for c in connections] self.weights=[c(1) for c in connections] else: self.connected=[] self.weights=[] Others have addressed the lack of need for accessors. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent of TCL's "subst" ?

2007-11-13 Thread Larry Bates
gamename wrote: > Hi, > > In TCL, you can do things like: > set foobar "HI!" > set x foo > set y bar > subst $$x$y > HI! > > Is there a way to do this type of evaluation in python? > > TIA, > -T > myStore={} myStore['foobar&#x

Re: Feeding data into MySQLdb LOAD DATA from Python

2007-11-14 Thread Larry Bates
ven find writing to file and then loading it is very fast. I recommend tab delimited as that seems to work well. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: python application dll

2007-11-19 Thread Larry Bates
ule. For > my users who install my Windows application, I'd prefer that they not > have to install the entirety of Python on their machines. > > Thanks much, > D Turn the Python program into a COM object instead. Then it can be dispatched by any programming language and distr

Re: mimicking a file in memory

2007-11-20 Thread Larry Bates
self.filename = 'unknown' else: self.filename = filename fileobj = file(filename, "rb") -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: sending commands to parallel printer through python

2007-12-05 Thread Larry Bates
the printer in binary mode and write to it directly. If it is a networked printer you will need to write to the spooler. printer=open("LPT1", "wb") printer.write(int('01b', 16), int('40', 16) printer.close() -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Securely distributing python source code as an application?

2007-12-08 Thread Larry Bates
tnered with developers to use our product WebSafe to provide secure software distribution (among other uses for the service). Take a look at: http://www.websafe.com. We have a special program for developers that allows you to put our API inside your application as well. Larry Bates Vi

Re: download complete webpage with python

2007-12-08 Thread Larry Bates
age with python? Thanks! > > The images are separate from the html document. You have to parse the > html text, find the tags, and retrieve them. > Actually IMHO this is even more difficult than it sounds. Javascript can change the webpage after it loads. Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: need the unsigned value from dl.call()

2007-12-11 Thread Larry Bates
value * 2. That should get you the unsigned value you want in a long. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: need the unsigned value from dl.call()

2007-12-11 Thread Larry Bates
Diez B. Roggisch wrote: > Larry Bates wrote: > >> eliss wrote: >>> I'm using dl.call() to call a C function in an external library. It's >>> working great so far except for one function, which returns an >>> unsigned int in the C version. Howev

Re: Elementtree find problem

2007-12-11 Thread Larry Bates
7;) > print coord > > > ___ > > the result is 'None' ... > > If I print out the kml with tostring I can see the entire file and to > me the XPath string also seems correct > > any idea? This works: >>> url='http://e

Re: String of integers separated by commas surrounded by square brackets to a list (was Re:)

2007-12-11 Thread Larry Bates
-- >> Looking for last minute shopping deals? Find them fast with Yahoo! >> Search. >> <http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping> >> >> If you know the string doesn't contain anything evil (that is you control where it comes from) you can also do: mylist=eval(s) -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding Line numbers of HTML file

2007-12-12 Thread Larry Bates
do you think you need the line numbers)? Extraction is done using tags not line numbers. All that said, you should look at Beautiful Soup module before continuing. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: A way of checking if a string contains a number

2007-12-12 Thread Larry Bates
string. IMHO regular expressions are overkill for the task you describe. You may be better served to just try to convert it to whatever number you want. try: value=int(string1) except ValueError: # do whatever you want for non integers here else: # do whatever you want for integers here Or use string methods: if string1.isdigit(): print "digits found" else: print "alphas found" -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Clearing a DOS terminal in a script

2007-12-16 Thread Larry Bates
s.stdout.write(chr(27)+'[2J') sys.stdout.flush() Unfortunately that doesn't clear the screen because the ANSI module isn't loaded by default. Use os.system('cls') as mentioned instead. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for gui for python code

2007-12-16 Thread Larry Bates
think wxWindows works extremely well but the learning curve is quite steep. The upside is that it is cross-platform and there is virtually nothing you can't write using wxPython/Windows. BTW-They hae an excellent newsgroup at: gmane.comp.python.wxpython -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: in-client web server

2007-12-16 Thread Larry Bates
rom web browser. Does this sound at all like what you are looking for? No firewall issues and I even tunneled ports securely over ssh and it worked flawlessly. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: why this error?

2007-12-16 Thread Larry Bates
ion with free variables > > I have no reason why you're getting the error, but there is no reason to try > to exec an import. Just use > > import sys > > Hope that helps. > > j > Don't exec "import sys" just do import sys. Also. a=range(15) b=[13,3] c=filter(lambda x: x not in b,a) is just: c=[x for x in xrange(15) if x not in [13,3]] IMHO this is much easier to read. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Deleting lines from a file

2007-12-17 Thread Larry Bates
periodically "pack" the file with a separate process. That could run unattended (e.g. at night). Or, if I did this a lot, I would use a database instead. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Strict mode?

2007-12-18 Thread Larry Bates
If I do, a good editor with search/replace seems to do the trick. I find it quite uncommon to change the "types" of arguments, but when I do, I can use duck typing to work around that as well. Hang in there, you will get it. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Preprocessing of input for the interactive interpreter?

2007-12-19 Thread Larry Bates
ormat send to interpreter after preprocessing: > >>>> b = 10*a + 0.1 > > > Best regards > > Stefan Salewski > I'm no expert, but I'll bet that pyparsing module will be the answer to your question. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: help displaying pdf thru client/server

2007-12-19 Thread Larry Bates
say if the Linux server was local or not. If local, you could use SAMBA to create a SMB share and have the XP PC get to it that way. There are other ways, but these should get you started. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simple way to parse this string ?

2007-12-19 Thread Larry Bates
the contents. If you read if from a user they could type in: os.system('rm -rf *') or os.system('del *.*') eval that and it deletes all the files on your disk -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: scanning through page and replacing all instances of 00:00:00.00

2006-04-17 Thread Larry Bates
f '00:00:00.00', would i use regular expressions? You could use regular expressions or you might want to take a look at Beautiful Soup http://www.crummy.com/software/BeautifulSoup to parse the page and replace the offending text. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-17 Thread Larry Bates
w. You will find that most Python programmers bristle at words like "missing", "enforcement" and "strictly defined the type". Python programmers just don't work that way. The fact that programmers in other languages must, is their loss. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple DAV server?

2006-04-18 Thread Larry Bates
Zope presents objects/folders via WebDAV. It isn't "simple", but it works and is a Python "thing". On Windows you can get a demo of GroupDrive here: http://www.webdrive.com/products/groupdrive/index.html -Larry Bates robert wrote: > For testing purposes I'

Re: newbie OO question

2006-04-20 Thread Larry Bates
object such as a list or dictionary used as default value will be shared by all calls that don't specify an argument value for the corresponding slot; this should usually be avoided. Change to something like: __init__(self,seg=None,value=0,description=""): self.segment=seg or [0,0,0,0,0,0] self.value=value self.description=description -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: the whole 'batteries included' idea

2006-04-20 Thread Larry Bates
included'? > > I hope that question even makes sense! :) I believe Python is unique in the depth of the standard library when compared to most languages. Most require that you purchase or get many of the "batteries" from somewhere outside the standard distribution. Thi

Re: Phython and graphing

2006-04-20 Thread Larry Bates
big brother ReportLab PDF generator, but works equally well. In addition, it works well if you want to put graphs into .PDF documents. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding Module Dependancies

2006-04-21 Thread Larry Bates
not), you should look at the Python plug-in for Eclipse. Remember that Python is so dynamic that you can build dependencies during program execution and import them on-the-fly. So a dependency checker would always be incomplete. You always need to write unit tests. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-web-based templating system

2006-04-28 Thread Larry Bates
on works: ReportLab PageCatcher - reads .PDF background templates (note: not free) ReportLab - allows you to write on top of the .PDF template to produce a .PDF file as output. The results are a very high quality .PDF output document. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser and multiple option names

2006-05-02 Thread Larry Bates
igParser() INI.read(inifilepath) section="directories" dirs=[x for x in INI.options(section) if x.startswith('dir_')] or more easily: [init] dirs=/home/florian,/home/john,home/whoever and in program do: section="init" dirs=INI.get(section, 'dirs'

Re: RFC 822 continuations

2006-05-02 Thread Larry Bates
ontinuations are represented by an embedded newline then leading whitespace. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: __getattr__ on non-instantiated class

2006-05-03 Thread Larry Bates
Python to execute a method on an uninstantiated class. I can't imagine how you would use such a thing. Can you give us a real-life "use case"? This produces the output you want: m=MyClass() print m.prop() -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuple assignment and generators?

2006-05-04 Thread Larry Bates
ys return true. > > Any hints on what I'm missing? > > Thanks, > > -tkc > > While I have never needed anything like this in my 5 years of Python programming, here is a way: a,b,c = 3*[0] q,r,s,t,u,v = 6*[0] of if you like: def zeros(num): return num*[0] a

Re: Tuple assignment and generators?

2006-05-04 Thread Larry Bates
Just wrote: > In article <[EMAIL PROTECTED]>, > Larry Bates <[EMAIL PROTECTED]> wrote: > >> While I have never needed anything like this in my 5 years of Python >> programming, here is a way: >> >> a,b,c = 3*[0] >> q,r,s,t,u,v = 6*[0] > &

Re: how to remove 50000 elements from a 100000 list?

2006-05-05 Thread Larry Bates
lapsed time=0.05 seconds sets elapsed time=0.03 seconds There may be other ways using bisect or some other module. If data is random, unsorted or has duplicates, I would look at in-memory database like SQLlite instead. If the values are unique you can do something like: a=set(range(10)) b=set(rang

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Larry Bates
_value. Normally you do something like: l_value=None . . Intervening code . if l_value is None: print "l_value uninitialized" Or (something I never use): if not locals().has_key('l_value'): print "l_value uninitialized" -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: [ConfigParser] value with ; and the value blank

2006-05-05 Thread Larry Bates
om (not recommended unless you don't control the format of the file). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: to thine own SELF be true...

2006-05-05 Thread Larry Bates
ve the method (e.g. sort of like local variables in a function). If you want them to be instance attributes the "self." is required. Now if you use them a lot you can create shortcuts inside the method. The lack of "self." is how python knows if this is a temporary lo

Re: how to remove 50000 elements from a 100000 list?

2006-05-05 Thread Larry Bates
ce >> >> thank you all again! > > Be warned that this may /add/ items to a: > >>>> set("abc").symmetric_difference("bcd") > set(['a', 'd']) > > If your subject is correct you want difference(), not > symmetric_difference(). > > Peter Whoops. My bad. Peter is correct. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: print formate

2006-05-05 Thread Larry Bates
mulator = accumulator + data > gives a list of tuples which when printed looks like > ('jack', 'bony', 'J') > ('sam', 'lee', 'S') > ... > > how can I get the output in the formate > jack bony J > sam lee S > ..

Re: Replace

2006-05-06 Thread Larry Bates
r.index() dosn't work because... > > str = "hello world" > for i in str: > print str.index(i) > > 0 > 1 > 2 > 2 > 4 > 5 > 6 > 4 > 8 > 2 > 10 > > Every 'e' in "hello world" has the same index value. Am i missing somthing? Split the string on '=', and join it back with '=#'. s='=#'.join(s.split('=')) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: reading a column from a file

2006-05-08 Thread Larry Bates
Check out the csv module. -Larry Bates Gary Wessle wrote: > Hi > > I have a file with data like > location pressure temp > str flootfloot > > I need to read pressure and temp in 2 different variables so that I > can plot them as lines. is there a package wh

Re: A better way to split up a list

2006-05-08 Thread Larry Bates
end(i) > return outputlist > movelist = [1,2,3,4,5,6,7,8,9,10,11] > print chopupmoves(movelist) > Try something like this: def chopupmoves(movelist): return [movelist[0:3], movelist[3:6], movelist[6:]] -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: A better way to split up a list

2006-05-08 Thread Larry Bates
end(i) > return outputlist > movelist = [1,2,3,4,5,6,7,8,9,10,11] > print chopupmoves(movelist) > Try something like this: def chopupmoves(movelist): return [movelist[0:3], movelist[3:6], movelist[6:]] -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: reading a column from a file

2006-05-08 Thread Larry Bates
Check out the csv module. -Larry Bates Gary Wessle wrote: > Hi > > I have a file with data like > location pressure temp > str flootfloot > > I need to read pressure and temp in 2 different variables so that I > can plot them as lines. is there a package wh

Re: connect file object to standard output?

2006-05-08 Thread Larry Bates
port sys def write_data(data, out_file=None): if out_file is None: fp = sys.stdout # how to connect standard output to fp? else fp = open(out_file,"w") fp.write(data) # more fp.write() statements follow -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: do "some action" once a minute

2006-05-09 Thread Larry Bates
application as a Windows Service and have it sleep for however long you want. It won't impact your system looping and sleeping. It will also be asynchronous, as it will sleep for time you specify, run your code to completion and then sleep again which isn't the same as running

Re: Progress bar in web-based ftp?

2006-05-09 Thread Larry Bates
TML POST action=upload doesn't give you anything to work with to provide such information to the client's browser (if it does I'm not aware of it anyway). It also would take something like JavaScript and XMLRPC on the client to make the round trip to get updated progress information. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: How to recast integer to a string

2006-05-09 Thread Larry Bates
2) Either s=str(n) or s="%i" % n will return string containing '5' (without the quotes of course). Note: chr(n) would return character whose ASCII decimal value is 5 (ASCII ENQ). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL thumbnails unreasonably large

2006-05-10 Thread Larry Bates
g thumbnail is supposed to be < 10 kb... > > Thank You, > > Almad > JPEG quality 200 is overkill, btw -- it completely disables JPEG's quantization stage, and "mainly of interest for experimental pur- poses", according to the JPEG library documentation, which conti

Re: saving file permission denied on windows

2006-05-15 Thread Larry Bates
le. Note that O/S is saying that permission is denied to the folder name stored in self.output: "D:\\Szymek\\python\\pythumb\\images\\proba" You most likely meant: img.save(os.path.join(self.output, file), "JPEG", optimize=1) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: constucting a lookup table

2006-05-16 Thread Larry Bates
htininches, weightinpounds)] except IndexError: print "height/weight combination not found in lookup table" -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

<    9   10   11   12   13   14   15   16   17   18   >