Re: include statement

2006-09-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Thanks to all who took time to answer! > > >> > is it possible in python to include another python source file into the >> > current namespace, i.e.completely analogous to the #include statement >> > in C. > > [...] > >> Tell us why you are contemplating such a thing

byte count unicode string

2006-09-20 Thread willie
Marc 'BlackJack' Rintsch: >In <[EMAIL PROTECTED]>, willie wrote: >> # What's the correct way to get the >> # byte count of a unicode (UTF-8) string? >> # I couldn't find a builtin method >> # and the following is memory inefficient. >> ustr = "example\xC2\x9D".decode('UTF-8') >> num_chars

Python Threading

2006-09-20 Thread daniel
Hello, Can anyone explain the main points in working with threads in Python. Why use threading and not Thread.I have read an article that i have to subclass the Thread class and override some function. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbe's re question

2006-09-20 Thread Eric
[EMAIL PROTECTED] wrote: > All I am after realy is to change this > > reline = re.line.split('instr', '/d$') > > into something that grabs any line with instr in it take all the > numbers and then grab any comment that may or may not be at the end of > the line starting with ; until the end of the

Re: byte count unicode string

2006-09-20 Thread John Machin
willie wrote: > Marc 'BlackJack' Rintsch: > > >In <[EMAIL PROTECTED]>, willie wrote: > >> # What's the correct way to get the > >> # byte count of a unicode (UTF-8) string? > >> # I couldn't find a builtin method > >> # and the following is memory inefficient. > > >> ustr = "example\xC2\x9D"

Re: Installing 2.5 with 2.4?

2006-09-20 Thread Duncan Booth
"John Machin" <[EMAIL PROTECTED]> wrote: > 1. You need to set your path manually. A BAT file called pypath.bat > placed somewhere on your PATH and containing: > path c:\python%1;c:\python%1\scripts;%path% > might come in handy. Warning: this is best used once each time you open > up a command

Re: include statement

2006-09-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Thanks to all who took time to answer! > > >>> is it possible in python to include another python source file into the >>> current namespace, i.e.completely analogous to the #include statement >>> in C. > > [...] > >> Tell us why you are contemplating such a thing, an

byte count unicode string

2006-09-20 Thread willie
>willie wrote: >> Marc 'BlackJack' Rintsch: >> >> >In <[EMAIL PROTECTED]>, willie wrote: >> >> # What's the correct way to get the >> >> # byte count of a unicode (UTF-8) string? >> >> # I couldn't find a builtin method >> >> # and the following is memory inefficient. >> >> ustr =

Re: byte count unicode string

2006-09-20 Thread MonkeeSage
John Machin wrote: > The answer is, "You can't", and the rationale would have to be that > nobody thought of a use case for counting the length of the UTF-8 form > but not creating the UTF-8 form. What is your use case? Playing DA here, what if you need to send the byte-count on a server via a he

Re: why a main() function?

2006-09-20 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: >> I think I read a suggestion somewhere to wrap the code where a Python >> script starts in a main() function, so one has > > > >> What are the advantages of doing this? > > Others have stated all the good ones, so I'll state a slightly dumbe

Re: byte count unicode string

2006-09-20 Thread Diez B. Roggisch
MonkeeSage schrieb: > John Machin wrote: >> The answer is, "You can't", and the rationale would have to be that >> nobody thought of a use case for counting the length of the UTF-8 form >> but not creating the UTF-8 form. What is your use case? > > Playing DA here, what if you need to send the by

Re: byte count unicode string

2006-09-20 Thread Duncan Booth
"MonkeeSage" <[EMAIL PROTECTED]> wrote: > John Machin wrote: >> The answer is, "You can't", and the rationale would have to be that >> nobody thought of a use case for counting the length of the UTF-8 form >> but not creating the UTF-8 form. What is your use case? > > Playing DA here, what if yo

Re: byte count unicode string

2006-09-20 Thread Paul Rubin
Duncan Booth <[EMAIL PROTECTED]> writes: > I guess you could invent something like inserting a string into a database > which has fixed size fields, silently truncates fields which are too long > and stores the strings internally in utf-8 but only accepts ucs-2 in its > interface. Pretty far fet

Re: new string method in 2.5 (partition)

2006-09-20 Thread MonkeeSage
s = "There should be one -- and preferably only one -- obvious way to do it".partition('only one') print s[0]+'more than one'+s[2] ;) Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: byte count unicode string

2006-09-20 Thread MonkeeSage
OK, so the devil always loses. ;P Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: byte count unicode string

2006-09-20 Thread John Machin
willie wrote: > >willie wrote: > >> Marc 'BlackJack' Rintsch: > >> > >> >In <[EMAIL PROTECTED]>, willie > wrote: > >> >> # What's the correct way to get the > >> >> # byte count of a unicode (UTF-8) string? > >> >> # I couldn't find a builtin method > >> >> # and the following is memory

jpype package, could be path problem

2006-09-20 Thread kelemen.viktor
Hello! Im a quite newbie in the python world. I have some problem with packages, i installed the jpype package according to its intructions. To test ive written: > python >>> import jpype everything worked correctly but when i wrote a short script: " from jpype import * jpype.startJVM('/usr/lib/

byte count unicode string

2006-09-20 Thread willie
John Machin: >You are confusing the hell out of yourself. You say that your web app >deals only with UTF-8 strings. Where do you get "the unicode string" >from??? If name is a utf-8 string, as your comment says, then len(name) >is all you need!!! # I'll go ahead and concede defeat since you

Re: Installing 2.5 with 2.4?

2006-09-20 Thread John Machin
Duncan Booth wrote: > "John Machin" <[EMAIL PROTECTED]> wrote: > > > 1. You need to set your path manually. A BAT file called pypath.bat > > placed somewhere on your PATH and containing: > > path c:\python%1;c:\python%1\scripts;%path% > > might come in handy. Warning: this is best used once ea

Re: jpype package, could be path problem

2006-09-20 Thread Rob Wolfe
kelemen.viktor wrote: > everything worked correctly but when i wrote a short script: > " > from jpype import * > > jpype.startJVM('/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/i386/client/libjvm.so','-ea') > java.lang.System.out.println("hello world") > shutdownJVM() > " > and tried to run it thi

Re: Cheese Shop Registration error

2006-09-20 Thread alefnula
Thank You all! :) I successfully registered and submited my first package :) Richard Jones wrote: > John Machin wrote: > > re.match("[A-Fa-f0-9]{8,8}", data.strip()) makes it plain what is > > intended ... > > Indeed, thanks. > > > Richard -- http://mail.python.org/mailman/listinfo/python

Re: Cheese Shop Registration error

2006-09-20 Thread alefnula
Thank You all! :) I successfully registered and submited my first package :) Richard Jones wrote: > John Machin wrote: > > re.match("[A-Fa-f0-9]{8,8}", data.strip()) makes it plain what is > > intended ... > > Indeed, thanks. > > > Richard -- http://mail.python.org/mailman/listinfo/python

Embedding Python and command history

2006-09-20 Thread Stefan Bellon
Hi all! I'm embedding Python in my own C (or rather Ada, but via the C interface) program. Everything runs fine. But I have a small question regarding command history. Let's take the simplest example: #include int main(void) { Py_Initialize(); PyRun_InteractiveLoop(stdin, ""); Py_Finalize

Re: Installing 2.5 with 2.4?

2006-09-20 Thread Tim Peters
[Duncan Booth] >> Windows is only smart enough to avoid duplicate entries if you tell it >> to do that. e.g. >> >> PATH c:\python25;c:\python25\scripts;%PATH:c:\python25;c:\python25\scripts;=% >> >> will add the two Python 2.5 folders to the head of the path without >> duplicating them. [John Mach

Re: byte count unicode string

2006-09-20 Thread John Machin
willie wrote: > John Machin: > > >You are confusing the hell out of yourself. You say that your web app > >deals only with UTF-8 strings. Where do you get "the unicode string" > >from??? If name is a utf-8 string, as your comment says, then len(name) > >is all you need!!! > > > # I'll go ahead

Re: byte count unicode string

2006-09-20 Thread Diez B. Roggisch
willie wrote: > John Machin: > > >You are confusing the hell out of yourself. You say that your web app > >deals only with UTF-8 strings. Where do you get "the unicode string" > >from??? If name is a utf-8 string, as your comment says, then len(name) > >is all you need!!! > > > # I'll go ah

ANN: eGenix mxODBC Zope Database Adapter 1.0.10 for Intel Mac OS X

2006-09-20 Thread eGenix Team: M.-A. Lemburg
ANNOUNCEMENT EGENIX.COM mxODBC Zope Database Adapter Version 1.0.10 Usable with Zope and the Plone CMS. Avail

test, please ignore

2006-09-20 Thread Sjoerd Mullender
This is a test message from your mailing list administrator. Please ignore. -- Sjoerd Mullender -- http://mail.python.org/mailman/listinfo/python-list

Re: SETUP - Introducing "setuptools" to a project without risk

2006-09-20 Thread Ilias Lazaridis
Ilias Lazaridis wrote: > If I understood things right, setuptools extends the functionality of > distutils > > Thus replacing within a setup.py: > > from distutils.core import setup > > with > > try: > from setuptools import setup > except ImportError: > from distutils.core import setup > >

byte count unicode string

2006-09-20 Thread willie
John Machin: >Good luck! Thank you for your patience and for educating me. (Though I still have a long way to go before enlightenment) I thought Python might have a small weakness in lacking an efficient way to get the number of bytes in a "UTF-8 encoded Python string object" (proper?), but I'v

Re: newbe's re question

2006-09-20 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: > All I am after realy is to change this > > reline = re.line.split('instr', '/d$') > > into something that grabs any line with instr in it take all the > numbers and then grab any comment that may or may not be at the end of > the line starting with ; until the end of the

Re: RELEASED Python 2.5 (FINAL)

2006-09-20 Thread Ben Sizer
Anthony Baxter wrote: > It's been nearly 20 months since the last major release > of Python (2.4), and 5 months since the first alpha > release of this cycle, so I'm absolutely thrilled to be > able to say: > > On behalf of the Python development team > and the Python community, I'm happy t

Request for elucidation: enhanced generators

2006-09-20 Thread Ben Sizer
A simple question - can anybody give a short example of how these work and what they are good for? I've read PEP 342 and the associated bit in the What's New section and it's still all Greek to me. The latter seems to focus on how to do it, rather than why you'd do it, so it doesn't aid the underst

Re: jpype package, could be path problem

2006-09-20 Thread kelemen.viktor
Hi thanks for your suggestions ive modified the sample code " import jpype from jpype import * jpype.startJVM('/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/i386/client/libjvm.so','-ea') java.lang.System.out.println("hello world") shutdownJVM() " and its working. It seems to be quite strange. W

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Steve Holden
Ben Sizer wrote: > A simple question - can anybody give a short example of how these work > and what they are good for? I've read PEP 342 and the associated bit in > the What's New section and it's still all Greek to me. The latter seems > to focus on how to do it, rather than why you'd do it, so i

Re: jpype package, could be path problem

2006-09-20 Thread Rob Wolfe
kelemen.viktor wrote: > Hi > > thanks for your suggestions > > ive modified the sample code You've modified it incorrect. > " > import jpype > from jpype import * You should use "import jpype" OR "from jpype import *" (not recommended) but NOT BOTH. > jpype.startJVM('/usr/lib/jvm/java-1.5.0-su

Re: high level, fast XML package for Python?

2006-09-20 Thread Fredrik Lundh
Martin v. Löwis wrote: >> Is there a standard xml package for Python? Preferably high-level, fast >> and that can parse in-file, not in-memory since I have to deal with >> potentially MBs of data. > > It seems that everybody is proposing libraries that use in-memory > representations. There is

Re: pprint: "...thank small children who sleep at night."

2006-09-20 Thread Fredrik Lundh
Brian L. Troutwine wrote: > Is the last sentence an obscure reference or in-joke? Can someone > explain it? I don't get it. do you have small kids? tried doing serious programming while they're still awake? -- http://mail.python.org/mailman/listinfo/python-list

Re: Single character input without pressing 'Enter'

2006-09-20 Thread Fredrik Lundh
unni.tallman wrote: > how can i read input from stdin, char by char, i want to get the > character as soon as it is entered, without having to press 'Enter' > after each character. related FAQ entries: http://pyfaq.infogami.com/how-do-i-get-a-single-keypress-at-a-time http://pyfaq.infogami.com/h

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Ilias Lazaridis
MonkeeSage wrote: > Ilias Lazaridis wrote: > > where do I place this function... > > The place where you want it to be. > > > ...thus it becomes available within class "Foo" and all other Classes? > > Anything defined in the top-level (i.e., the sys.modules['__main__'] > namespace) is accessible in

How to measure memory footprint of Python objects?

2006-09-20 Thread Neagu, Adrian
Hello everybody, I try to solve the following problem: I have a python program that takes a lot of memory (>hundred Mb). I made an improvement (I hope) and I want to measure the gain (if possible on several platforms). I would like to be able to print the max memory taken during the run upon exiti

Re: How to measure memory footprint of Python objects?

2006-09-20 Thread Fredrik Lundh
Neagu, Adrian wrote: > I have a python program that takes a lot of memory (>hundred Mb). > I can see the total process size of the Python process (Task manager on MS > Win or Unix "ps" command) but that is not precise enough for me I'm not sure those two statements are compatible, though. if yo

Re: How to measure memory footprint of Python objects?

2006-09-20 Thread Paul Rubin
"Neagu, Adrian" <[EMAIL PROTECTED]> writes: > I would like to get that size at different given moments in time to make up > a timeline of memory consumption. But, if that is too tricky, I would be > happy to just get the maximum. > > Any suggestion welcome, See the docs for the gc module. -- htt

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Ben Sizer
Steve Holden wrote: > Ben Sizer wrote: > > A simple question - can anybody give a short example of how these work > > and what they are good for? I've read PEP 342 and the associated bit in > > the What's New section and it's still all Greek to me. The latter seems > > to focus on how to do it, rat

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread MonkeeSage
Ilias Lazaridis wrote: > no, I don't know it. OK...so how do you evaluate a language when you don't know its basic operations? Hmmm, sounds fishy. > how do I define something into the top-level namespace? I assume I > could place it into the root-package of my project, into the __init__ > functio

Using py2exe to wrap a service?

2006-09-20 Thread Maria . Reinhammar
I have an app using active_directory.py and the std module asyncore in a Windows Service. Works perfectly! That is, until I try to use py2exe to create a standalone (need to avoid installing the entire Python etc. on the target system). When I try to start the installed Service, the system tells m

Re: How to measure memory footprint of Python objects?

2006-09-20 Thread AdrianNg3
Paul Rubin wrote: > See the docs for the gc module. This is the first place I've checked. I see no useful info there about the actual size of the objects (bytes occupied in memeory). The closest thing to what I need is get_objects( ). Then I have to go over the list and do something with the obje

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Fredrik Lundh
Ben Sizer wrote: > But do you have an example of such a use case? here's what I think is the first published example that uses "yield" for co-routine-like behaviour: http://effbot.org/zone/asyncore-generators.htm that snippet uses a generator to implement a simple network protocol. the g

Nested Looping SQL Querys

2006-09-20 Thread Fuzzydave
I am back developing futher our Python/CGI based web application run by a Postgres DB and as per usual I am having some issues. It Involves a lot of Legacy code. All the actual SQL Querys are stored in the .py files and run in the .cgi files. I have the problem that I need to construct a row from t

Re: Embedding Python and command history

2006-09-20 Thread Stefan Bellon
Stefan Bellon wrote: > int main(void) > { > Py_Initialize(); > PyRun_InteractiveLoop(stdin, ""); > Py_Finalize(); > } > How can I make use of command history when embedded Python via > PyRun_InteractiveLoop? Sorry to follow up my own posting ... I found that when I do "import readline" in

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Duncan Booth
"Ben Sizer" <[EMAIL PROTECTED]> wrote: >> If you have no use case for this you are, as always, perfectly free to >> ignore it, as the majority of Python users may well choose to do. Your >> existing generators should continue to work. > > But do you have an example of such a use case? That's what

Re: Pyglade, gtk, howto write more efficiently, and waste less code?

2006-09-20 Thread Pipiten
Thanks thomas!, i did it that way ;). maybe someone can help me with this, it seems simple, but i don`t know how to do it. I have: self.paths = ["","path1","path2","path3","path4","path5"] self.paths[1] = self.wTree.get_widget("path1") self.paths[2] = self.wTree.get_widget

Re: How to measure memory footprint of Python objects?

2006-09-20 Thread AdrianNg3
Fredrik Lundh wrote: > Neagu, Adrian wrote: > > > I have a python program that takes a lot of memory (>hundred Mb). > > > I can see the total process size of the Python process (Task manager on MS > > Win or Unix "ps" command) but that is not precise enough for me > > I'm not sure those two stateme

Re: include statement

2006-09-20 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Thanks to all who took time to answer! > > >>> is it possible in python to include another python source file into the >>> current namespace, i.e.completely analogous to the #include statement >>> in C. > > [...] > >> Tell us why you are contemplating such a thing, an

Re: Using py2exe to wrap a service?

2006-09-20 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I have an app using active_directory.py and the std module asyncore in > a Windows Service. > Works perfectly! > That is, until I try to use py2exe to create a standalone (need to > avoid installing the entire Python etc. on the target system). > > When I try to start th

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Ant
Ben Sizer wrote: ... > But do you have an example of such a use case? That's what I'm missing > here. I've been looking at this myself, trying to understand the point of coroutines. I believe that they boil down to generators which are able to take in data as well as provide it. A simple way of l

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Michele Simionato
Duncan Booth wrote: > One example which is commonly given is to implement a web application using > continuations. So in Python terms a session is handled by a generator which > yields a form to be sent back to the user and the user's response is sent > in to the request using the generator's send

Mail Transaction Failed

2006-09-20 Thread Susan
The message contains Unicode characters and has been sent as a binary attachment. File attachment: document.msg.bat The file attached to this email was removed because the file name is not allowed. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way to condese my array

2006-09-20 Thread Wildemar Wildenburger
Robert Kern wrote: > Of course, code that I wouldn't get fired for would have a slightly greater > line > count and fewer one-letter variable names. Great :D! That one made me laugh! wildemar -- http://mail.python.org/mailman/listinfo/python-list

RE: Using py2exe to wrap a service?

2006-09-20 Thread Tim Golden
[EMAIL PROTECTED] [... snip ...] | File "win32com\client\__init__.pyc", line 73, in GetObject | File "win32com\client\__init__.pyc", line 88, in Moniker | pywintypes.com_error: (-2147221020, 'Invalid syntax', None, None) | | The offending line is: | import active_directory as AD | ... | for

Re: Using py2exe to wrap a service?

2006-09-20 Thread Thomas Heller
Tim Golden schrieb: > [EMAIL PROTECTED] > > [... snip ...] > > | File "win32com\client\__init__.pyc", line 73, in GetObject > | File "win32com\client\__init__.pyc", line 88, in Moniker > | pywintypes.com_error: (-2147221020, 'Invalid syntax', None, None) > | > | The offending line is: > | im

Re: newbe's re question

2006-09-20 Thread [EMAIL PROTECTED]
Frederic Rentsch wrote: > [EMAIL PROTECTED] wrote: > > All I am after realy is to change this > > > > reline = re.line.split('instr', '/d$') > > > > into something that grabs any line with instr in it take all the > > numbers and then grab any comment that may or may not be at the end of > > the

RE: Using py2exe to wrap a service?

2006-09-20 Thread Tim Golden
[Thomas Heller] | Tim Golden schrieb: | > [EMAIL PROTECTED] | > | > [... snip ...] | > | > | File "win32com\client\__init__.pyc", line 73, in GetObject | > | File "win32com\client\__init__.pyc", line 88, in Moniker | > | pywintypes.com_error: (-2147221020, 'Invalid syntax', None, None) | > |

Re: pprint: "...thank small children who sleep at night."

2006-09-20 Thread John Salerno
Brian L. Troutwine wrote: > thank small children who sleep at night. That seems like the kind of sentence that could become a tagline or something, and you just have to be in the know to understand where it comes from. :) -- http://mail.python.org/mailman/listinfo/python-list

Is it possible to change a picture resolution with Python?

2006-09-20 Thread Lad
Is it possible to change a picture resolution with Python? Let's say I have a picture with a resolution of 96 dpi and I would like to increase to 256dpi or higher. Thank you for your reply. LL -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace single character at given position

2006-09-20 Thread Roberto Bonvallet
[EMAIL PROTECTED] wrote: > Martin Kulas: >> Are there better (faster) ways to achieve my goal? >> I have looked through the methods of type ``string'' >> but I have not found any appropriate method or function. [...] > A second way is to use a list of strings with len=1. Like this: idx = 1 >>>

Re: pprint: "...thank small children who sleep at night."

2006-09-20 Thread Adam Jones
Brian L. Troutwine wrote: > The heading comment to pprint reads: > > # This is a simple little module I wrote to make life easier. I > didn't > # see anything quite like it in the library, though I may have > overlooked > # something. I wrote this when I was trying to read some heavily > nest

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Ilias Lazaridis
MonkeeSage wrote: > Ilias Lazaridis wrote: >> no, I don't know it. > > OK...so how do you evaluate a language when you don't know its basic > operations? Hmmm, sounds fishy. The learning-process is an important part of the evaluation. >> how do I define something into the top-level namespace? I

Re: How to get a Fix to an Abandoned Project?

2006-09-20 Thread Adam Jones
Gregory Piñero wrote: > Say hello to pydelicious's new home ;-) > http://code.google.com/p/pydelicious/ > > -Greg Unless you are the original project's maintainer or have their consent on this it is usually bad form to name your fork the same thing as the original project. Granted, for something

Interested in a Python User Group in Porto/Portugal?

2006-09-20 Thread Pedro Lima
There is now a list to help put together such a group: http://groups.google.com/group/python-porto Regards, Pedro Lima PS. please forward this message to people you think that could be interested. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to change a picture resolution with Python?

2006-09-20 Thread bearophileHUGS
Lad: > Is it possible to change a picture resolution with Python? > Let's say I have a picture with a resolution of 96 dpi and I would like > to increase to 256dpi or higher. "Resolution" is a too much overloaded word, from some point of view increasing the resolution of images is a very difficult

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Michele Simionato
(I don't believe I am responding to a notorious troll ...) One (bad) solution is to write in your sitecustomize.py the following: $ echo /usr/lib/python/sitecustomize.py import __builtin__ class Object(object): def debug(self): print 'some debug info' __builtin__.object = Object th

ANN: Python-2.5 available at WebFaction

2006-09-20 Thread remi
Hello everyone, I'm happy to announce that WebFaction have now installed Python-2.5 on all their servers. WebFaction (formerly Python-Hosting.com) support all the major Python web frameworks (Django, TurboGears, CherryPy, mod_python, Pylons, web.py, ...) People using Python CGI or Python-2.5-com

Trouble Passing Array of Strings (using Numeric) to C Extension Module

2006-09-20 Thread goetzie
I am using Python 2.4.1 and Numeric 23.8 and running on Windows XP. I am passing a Numeric array of strings (objects) to a C Extension module using the following python code: import Numeric import TestDLL# my C Extension Module a = Numeric.array(['foo', 'bar'], 'O' ) print 'a =',

Re: Nested Looping SQL Querys

2006-09-20 Thread Bruno Desthuilliers
Fuzzydave wrote: (snip) """ pubID=cgiForm.getvalue('pubID') pubName=cgiForm.getvalue('pubName','Unknown Publication') sqlcheck1 = "SELECT pub_type FROM medusa.cmi_publication WHERE pub_id = '"+pubID+"'" overseas1 = conn.query(sqlcheck1) pubType = cmi.fetch_rows(overseas1) """ May we have the url

Re: Is it possible to change a picture resolution with Python?

2006-09-20 Thread Lad
from > image: > http://www.pythonware.com/library/pil/handbook/image.htm > > This is some example code: > > from PIL import Image > im = Image.open("1.jpg") > nx, ny = im.size > im2 = im.resize((int(nx*1.5), int(ny*1.5)), Image.BICUBIC) > im2.save("2.png") > > Bye, bearophile, Thank you for your r

Re: Nested Looping SQL Querys

2006-09-20 Thread Bruno Desthuilliers
Fuzzydave wrote: > I am back developing futher our Python/CGI based web application run by > a Postgres DB > and as per usual I am having some issues. It Involves a lot of Legacy > code. s/Legacy/Norwegian Blue/ -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.spl

Re: Nested Looping SQL Querys

2006-09-20 Thread Steve Holden
Bruno Desthuilliers wrote: > Fuzzydave wrote: > > (snip) > """ > pubID=cgiForm.getvalue('pubID') > pubName=cgiForm.getvalue('pubName','Unknown Publication') > > sqlcheck1 = "SELECT pub_type FROM medusa.cmi_publication WHERE pub_id = > '"+pubID+"'" > overseas1 = conn.query(sqlcheck1) > pubType = c

Re: Is it possible to change a picture resolution with Python?

2006-09-20 Thread bearophileHUGS
Lad: > But the above code increases size only , but not DPI resolutions( > vertical nad horizontal).I need a higher vertical and horisontal > resolutions. > Any idea how to do that? Do you need to overwrite the DPI tag contained in the header of a Jpeg/PNG image? Then you can probably find some

get process id...

2006-09-20 Thread SpreadTooThin
How does one get the process id? Is there a method for windows and unix (mac os x etc...) -- http://mail.python.org/mailman/listinfo/python-list

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Steve Holden
Michele Simionato wrote: > (I don't believe I am responding to a notorious troll ...) > Believe it. You are. Ain't life a bitch? :-) > One (bad) solution is to write in your sitecustomize.py the following: > > $ echo /usr/lib/python/sitecustomize.py > import __builtin__ > > class Object(object)

Re: get process id...

2006-09-20 Thread georgeryoung
SpreadTooThin wrote: > How does one get the process id? > Is there a method for windows and unix (mac os x etc...) under linux, do: import os os.getpid() -- http://mail.python.org/mailman/listinfo/python-list

Python regular expression question!

2006-09-20 Thread unexpected
I'm trying to do a whole word pattern match for the term 'MULTX-' Currently, my regular expression syntax is: re.search(('^')+(keyword+'\\b') where keyword comes from a list of terms. ('MULTX-' is in this list, and hence a keyword). My regular expression works for a variety of different keyword

Re: Python regular expression question!

2006-09-20 Thread Hallvard B Furuseth
"unexpected" <[EMAIL PROTECTED]> writes: > I'm trying to do a whole word pattern match for the term 'MULTX-' > > Currently, my regular expression syntax is: > > re.search(('^')+(keyword+'\\b') \b matches the beginning/end of a word (characters a-zA-Z_0-9). So that regex will match e.g. MULTX-FOO

Leaks in subprocess.Popen

2006-09-20 Thread zloster
I'm using Python 2.4.3 for Win32. I was trying to run a few child processes simultaneously in separate threads and get their STDOUT, but the program was leaking memory and I found that it was because of subprocess operating in another thread. The following code works fine, but I get a leaking handl

Re: Is it possible to change a picture resolution with Python?

2006-09-20 Thread Diez B. Roggisch
> Thank you for your reply. > But the above code increases size only , but not DPI resolutions( > vertical nad horizontal).I need a higher vertical and horisontal > resolutions. > Any idea how to do that? The DPI is nothing an image contains by itself - it depends on the resolution of the render

Re: high level, fast XML package for Python?

2006-09-20 Thread Martin v. Löwis
Paul Boddie schrieb: >> It seems that everybody is proposing libraries that use in-memory >> representations. There is a standard xml package for Python, it's >> called "xml" (and comes with the standard library). It contains a >> SAX interface, xml.sax, which can parse files incrementally. > > Wh

Re: Nested Looping SQL Querys

2006-09-20 Thread Steve Holden
Dennis Lee Bieber wrote: [...] > # not conn.execute() ? That's what all the DB-API compliant adapters > use > > result = conn.execute(sql, params) > .execute() is a cursor method, not a connection method. Some DB API modules do implement it as a connection method, but that makes it impo

Re: byte count unicode string

2006-09-20 Thread Martin v. Löwis
willie schrieb: > Thank you for your patience and for educating me. > (Though I still have a long way to go before enlightenment) > I thought Python might have a small weakness in > lacking an efficient way to get the number of bytes > in a "UTF-8 encoded Python string object" (proper?), > but I've

Do we need to delete "ImageDraw.Draw" after using it?

2006-09-20 Thread Daniel Mark
Hello all: I am looking the sample code posted on PIL website http://www.pythonware.com/library/pil/handbook/imagedraw.htm <> import Image, ImageDraw im = Image.open("lena.pgm") draw = ImageDraw.Draw(im) draw.line((0, 0) + im.size, fill=128) dra

unicode mystery/problem

2006-09-20 Thread Petr Jakes
Hi, I am using Python 2.4.3 on Fedora Core4 and "Eric3" Python IDE . Below mentioned code works fine in the Eric3 environment. While trying to start it from the command line, it returns: Traceback (most recent call last): File "pokus_1.py", line 5, in ? print str(a) UnicodeEncodeError: 'asc

Re: newbe's re question

2006-09-20 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: > Frederic Rentsch wrote: > >> [EMAIL PROTECTED] wrote: >> >>> All I am after realy is to change this >>> >>> reline = re.line.split('instr', '/d$') >>> >>> into something that grabs any line with instr in it take all the >>> numbers and then grab any comment that

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Ilias Lazaridis
George Sakkis wrote: > Ilias Lazaridis wrote: > > > I like to add a method "writeDebug(self, msg)" to all (or the most > > possible) classes in the system. > > > > How do I do this? > > > > * with new style classes > > * with old style classes > > Short answer: you can't do it for builtin or extens

Looking for a reports module/project

2006-09-20 Thread John Purser
Hello, I'm working on a script to gather data from our servers and then present the data as part of daily maintenance. Pretty straight forward stuff. However one of the limitations of an earlier design was presentation of the data so I'm working to make this version's report much clearer. I hate

Re: Do we need to delete "ImageDraw.Draw" after using it?

2006-09-20 Thread John Bokma
"Daniel Mark" <[EMAIL PROTECTED]> wrote: > Is there any general rule that we must delete the object after using > it? In general: if the object is not destroyed when it goes out of scope (but later) and uses precious resources [1], or if a special clean up is required, you should delete it expl

Re: new string method in 2.5 (partition)

2006-09-20 Thread Irmen de Jong
Terry Reedy wrote: > "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in > message news:[EMAIL PROTECTED] >> Err... is it me being dumb, or is it a perfect use case for str.split ? > > s.partition() was invented and its design settled on as a result of looking > at some awkward constructions in t

Re: Python regular expression question!

2006-09-20 Thread unexpected
> \b matches the beginning/end of a word (characters a-zA-Z_0-9). > So that regex will match e.g. MULTX-FOO but not MULTX-. > So is there a way to get \b to include - ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a reports module/project

2006-09-20 Thread hg
John Purser wrote: > Hello, > > I'm working on a script to gather data from our servers and then present > the data as part of daily maintenance. Pretty straight forward stuff. > However one of the limitations of an earlier design was presentation of > the data so I'm working to make this version

Re: Mechanoid Web Browser - Recording Capability

2006-09-20 Thread alex_f_il
You can try SWExplorerAutomation (SWEA) (http:\\webunittesting.com). It works very well with the password protected sites. SWEA is .Net API, but you can use IronPython to access it. Seymour wrote: > I am trying to find a way to sign onto my Wall Street Journal account > (http://online.wsj.com/pub

How to evaluate the memory usage of a python program?

2006-09-20 Thread Daniel Mark
Hello all: I have a python program and would like to find out the maximum memory used by this program. Does Python provide such module so I could check it easily? Thank you -Daniel -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >