Re: Re: Web page data and urllib2.urlopen

2009-08-06 Thread Kushal Kumaran
On Fri, Aug 7, 2009 at 3:47 AM, Dave Angel wrote: > > > Piet van Oostrum wrote: >> >> >>> >>> DA> All I can guess is that it has something to do with "browser type" or >>> DA> cookies.  And that would make lots of sense if this was a cgi page. >>>  But >>> DA> the URL doesn't look like that, as it

Re: Generators through the C API

2009-08-06 Thread Stefan Behnel
Duncan Booth schrieb: > Lucas P Melo wrote: > >> Hello, I'm a total noob about the C API. Is there any way to create a >> generator function using the C API? I couldn't find anything like the >> 'yield' keyword in it. >> >> Thanks in advance. > > You define a new type with tp_flags including P

Re: help with threads

2009-08-06 Thread Michael Mossey
Ah yes, that explains it. Some of these long computations are done in pure C, so I'm sure the GIL is not being released. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to force SAX parser to ignore encoding problems

2009-08-06 Thread Stefan Behnel
Łukasz wrote: > I have a problem with my XML parser (created with libraries from > xml.sax package). When parser finds a invalid character (in CDATA > section) for example �, throws an exception SAXParseException. > > Is there any way to just ignore this kind of problem. Maybe there is a > way to

Re: How to fetch an XML file using an HTTPS query

2009-08-06 Thread Stefan Behnel
Tycho Andersen wrote: > Blah, forgot to include the list. When is python-list going to get Reply-To? Hopefully never. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: SDMX format

2009-08-06 Thread Stefan Behnel
xamdam wrote: > Does anyone know of python libs for writing SDMX XML format? > http://www.SDMX.org/resources/SDMXML/schemas/v2_0/common Looks like the page behind that link is broken, but in general, working with XML formats in Python isn't hard at all when you use ElementTree or lxml. The latter

Re: how to kill subprocess when Python process is killed?

2009-08-06 Thread alex23
On Aug 7, 3:42 pm, "mark.v.we...@gmail.com" wrote: > When I kill the main process (cntl-C) the subprocess keeps running. > How do I kill the subprocess too? The subprocess is likey to run a > long time. You can register functions to run when the Python process ends by using the atexit[1] module.

Re: one method of COM object needs a variant type variable

2009-08-06 Thread Gabriel Genellina
En Thu, 06 Aug 2009 09:37:55 -0300, MICHÁLEK Jan Mgr. escribió: How i can use this type in win32.com? One method of com object (geomedia storage service) needs this variable for storage geometry of geometry object (this variable will be writen into blob in DB). Is possible make this vari

Re: Help with regex

2009-08-06 Thread Nobody
On Thu, 06 Aug 2009 14:23:47 -0700, Ethan Furman wrote: >> [0-9]+ allows any number of leading zeros, which is sometimes undesirable. >> Using: >> >> (0|[1-9][0-9]*) >> >> is more robust. > > You make a good point about possibly being undesirable, but I question > the assertion that your

how to kill subprocess when Python process is killed?

2009-08-06 Thread mark.v.we...@gmail.com
I am writing a Python program that launches a subprocess (using Popen). I am reading stdout of the subprocess, doing some filtering, and writing to stdout of the main process. When I kill the main process (cntl-C) the subprocess keeps running. How do I kill the subprocess too? The subprocess is li

Re: Python docs disappointing - group effort to hire writers?

2009-08-06 Thread alex23
Paul Rubin wrote: > The PHP docs as I remember are sort of regular (non-publically > editable) doc pages, each of which has a public discussion thread > where people can post questions and answers about the topic of that > doc page.  I thought it worked really well.  

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-06 Thread Gabriel Genellina
En Thu, 06 Aug 2009 12:49:30 -0300, IronyOfLife escribió: On Aug 5, 4:18 pm, "Gabriel Genellina" wrote: En Tue, 04 Aug 2009 10:15:24 -0300, IronyOfLife escribió: > On Aug 3, 8:42 pm, "Gabriel Genellina" wrote: >> En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLife   >> escribió: >> > I hav

Re: Generate a new object each time a name is imported

2009-08-06 Thread Michele Simionato
On Aug 2, 1:18 pm, Paul Rubin wrote: > Peter Otten <__pete...@web.de> writes: > > >>> import sys > > >>> sys.modules["yadda"] = A() > > OMG wow.  I bow to you.  But I'm not sure whether that's bowing in > awe or in terror. I had to play this kind of tricks on our

Re: Python3: Using sorted(key=...)

2009-08-06 Thread Paul Rubin
Johannes Bauer writes: > def myorder(x): > if type(x[0]) == int: > return x[0] > else: > return x[0][0] I used to write code like that pretty regularly, but over time I found that it's better to stay consistent and use the same container format (in this case, tuples) f

Re: SMTP

2009-08-06 Thread Gabriel Genellina
En Fri, 07 Aug 2009 00:21:34 -0300, Sarmad George escribió: Good day all I am new to the Python list Welcome! My question is here not Python as much as it is in servers I have a code to send an email through my SMTP server - comcast Boston fromaddrs = "**" toaddrs = "sgeo...@coe.neu.

Re: help with threads

2009-08-06 Thread Loïc Domaigné
Hallo Michael, > I have a simple application that needs one thread to manage networking > in addition to the main "thread" that does the main job. It's not > working right. I know hardly anything about threads, so I was hoping > someone could point me in the right direction to research this. > > B

SMTP

2009-08-06 Thread Sarmad George
Good day all I am new to the Python list My question is here not Python as much as it is in servers I have a code to send an email through my SMTP server - comcast Boston fromaddrs = "**" toaddrs = "sgeo...@coe.neu.edu" msg = "Hello World" server = smtplib.SMTP ('76.96.30.117', '25') #COMCAST

Re: Custom namespaces

2009-08-06 Thread Michele Simionato
On Aug 2, 6:46 am, Chris Rebert wrote: > > Is there any way to install a custom type as a namespace? > > For classes/objects, yes, using metaclasses. > See the __prepare__() method in PEP > 3115:http://www.python.org/dev/peps/pep-3115/ Here is an example of usage: http://www.artima.com/weblogs/

Re: pylucene installation problem on Ubuntu 9.04

2009-08-06 Thread KK
On Aug 7, 12:38 am, Jon Clements wrote: > On 6 Aug, 19:49, KK wrote: > > > > > hi all, > > I've trying to install pylucene on my linux box from last 2 days but > > not able to do so. first i tried to install it using apt-get like > > this, > > kk-laptop$ sudo apt-get install pylucene > > and it d

Re: Using Python to automate builds

2009-08-06 Thread Gabriel Genellina
En Thu, 06 Aug 2009 14:27:56 -0300, Kosta escribió: On Aug 6, 3:57 am, David Cournapeau wrote: On Thu, Aug 6, 2009 at 12:39 AM, Kosta wrote: > Setenv.bat sets up the path and other environment variables build.exe > needs to compile and link (and even binplace) its utilities.  So > building i

Pure python implementation of string.format?

2009-08-06 Thread nathan binkert
I was wondering if there was a pure python version of string.format anywhere that could be used with python 2.4 and python 2.5. Searching has only turned up an early implementation done for pep 3101, but it seems that it didn't get that far. Thanks, Nate -- http://mail.python.org/mailman/list

need help with an egg

2009-08-06 Thread jo
Hi, I am very new to python I created an egg on a machine. The Python version on that is 2.5. Copied that egg to a machine which has Python 2.6. unzip -t Myproj-0.1-py2.5.egg The above command shows all the files I need When I run the easy_install, I get the foll. error. Is it because of

help with threads

2009-08-06 Thread Michael Mossey
Hello, I have a simple application that needs one thread to manage networking in addition to the main "thread" that does the main job. It's not working right. I know hardly anything about threads, so I was hoping someone could point me in the right direction to research this. Basically, I have a

Re: Python3: Using sorted(key=...)

2009-08-06 Thread Johannes Bauer
MRAB schrieb: > Johannes Bauer wrote: >> Hello list, >> >> I'm having trouble with a incredibly simple sort of a list containing >> ints and tuples: >> >> def myorder(x): >> if type(x) == int: >> return x >> else: >> return x[0] >> >> odata = sorted([ (a, b) for (a, b) in da

Re: unicode() vs. s.decode()

2009-08-06 Thread John Machin
Jason Tackaberry urandom.ca> writes: > On Thu, 2009-08-06 at 01:31 +, John Machin wrote: > > Suggested further avenues of investigation: > > > > (1) Try the timing again with "cp1252" and "utf8" and "utf_8" > > > > (2) grep "utf-8" /Objects/unicodeobject.c > > Very pedagogical of you. :)

Re: Python3: Using sorted(key=...)

2009-08-06 Thread MRAB
Johannes Bauer wrote: Hello list, I'm having trouble with a incredibly simple sort of a list containing ints and tuples: def myorder(x): if type(x) == int: return x else: return x[0] odata = sorted([ (a, b) for (a, b) in data["description"].items

Re: unicode() vs. s.decode()

2009-08-06 Thread Michael Ströder
Thorsten Kampe wrote: > * Michael Ströder (Thu, 06 Aug 2009 18:26:09 +0200) > timeit.Timer("unicode('äöüÄÖÜß','utf-8')").timeit(1000) >> 17.23644495010376 > timeit.Timer("'äöüÄÖÜß'.decode('utf8')").timeit(1000) >> 72.087096929550171 >> >> That is significant! So the winner is: >> >>

Re: Help with regex

2009-08-06 Thread John Machin
On Aug 7, 7:23 am, Ethan Furman wrote: > Nobody wrote: > > On Thu, 06 Aug 2009 08:35:57 -0700, Robert Dailey wrote: > > >>I'm creating a python script that is going to try to search a text > >>file for any text that matches my regular expression. The thing it is > >>looking for is: > > >>FILEVERSI

Re: Subclassing Python's dict

2009-08-06 Thread Gabriel Genellina
En Thu, 06 Aug 2009 05:26:22 -0300, Xavier Ho escribió: On Thu, Aug 6, 2009 at 1:19 PM, alex23 wrote: Xavier Ho wrote: > You should subclass collections.UserDict, and not the default dict class. Xavier, why do you think that is the correct approach? I'll be honest first and say that I do

Re: Help making this script better

2009-08-06 Thread Gabriel Genellina
En Thu, 06 Aug 2009 11:50:07 -0300, jakecjacobson escribió: After much Google searching and trial & error, I was able to write a Python script that posts XML files to a REST API using HTTPS and passing PEM cert & key file. It seems to be working but would like some pointers on how to handle

Re: heapq "key" arguments

2009-08-06 Thread Joshua Bronson
On Aug 3, 1:36 pm, Raymond Hettinger wrote: > [Joshua Bronson]: > > > According tohttp://docs.python.org/library/heapq.html, Python 2.5 > > added an optional "key" argument to heapq.nsmallest and > > heapq.nlargest. I could never understand why they didn't also add a > > "key" argument to the othe

Python3: Using sorted(key=...)

2009-08-06 Thread Johannes Bauer
Hello list, I'm having trouble with a incredibly simple sort of a list containing ints and tuples: def myorder(x): if type(x) == int: return x else: return x[0] odata = sorted([ (a, b) for (a, b) in data["description"].items() ], key=myorder) stil

Re: Setuptools - help!

2009-08-06 Thread Robert Kern
On 2009-08-06 18:04, Peter Chant wrote: Chaps, any ideas, I'm floundering - I don't quite get it. I have the following files, setup.py and main.py in a directory pphoto: # more setup.py from setuptools import setup, find_packages setup( name = "Pphoto", version = "0.1", packages

Setuptools - help!

2009-08-06 Thread Peter Chant
Chaps, any ideas, I'm floundering - I don't quite get it. I have the following files, setup.py and main.py in a directory pphoto: # more setup.py from setuptools import setup, find_packages setup( name = "Pphoto", version = "0.1", packages = find_packages(), # other arguments he

Re: XML flaw

2009-08-06 Thread Mark Lawrence
MRAB wrote: Hi all, I've just read this article, which mentions Python: XML flaw threatens millions of apps with DoS attacks http://infoworld.com/print/86340 Something to worry about? No. Discussing letting Tom, Dick and Harriet loose on the Python documentaion is far more important than tri

Re: XML flaw

2009-08-06 Thread Chris Rebert
On Thu, Aug 6, 2009 at 3:05 PM, MRAB wrote: > Hi all, > > I've just read this article, which mentions Python: > > XML flaw threatens millions of apps with DoS attacks > http://infoworld.com/print/86340 > > Something to worry about? More detailed article: http://blogs.zdnet.com/open-source/?p=4609

Re: Help with regex

2009-08-06 Thread Ethan Furman
Nobody wrote: On Thu, 06 Aug 2009 08:35:57 -0700, Robert Dailey wrote: I'm creating a python script that is going to try to search a text file for any text that matches my regular expression. The thing it is looking for is: FILEVERSION #,#,#,# The # symbol represents any number that can be a

Re: Re: Web page data and urllib2.urlopen

2009-08-06 Thread Dave Angel
Piet van Oostrum wrote: DA> If Mozilla had seen a page with this line in an appropriate place, it'd DA> immediately begin loading the other page, at "someotherurl" But there's no DA> such line. DA> Next, I looked for javascript. The Mozilla page contains lots of DA> javascript, b

Re: Unexpected side-effects of assigning to sys.modules[__name__]

2009-08-06 Thread Steven D'Aprano
On Thu, 06 Aug 2009 20:01:42 +0200, Jean-Michel Pichavant wrote: > > I'm completely perplexed by this behaviour. sys.modules() seems to be > > a regular dict, at least according to type(), and yet assigning to an > > item of it seems to have unexpected, and rather weird, side-effects. > > > > Wha

XML flaw

2009-08-06 Thread MRAB
Hi all, I've just read this article, which mentions Python: XML flaw threatens millions of apps with DoS attacks http://infoworld.com/print/86340 Something to worry about? -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path.exists() and Samba shares

2009-08-06 Thread BDZ
On Jul 31, 10:56 pm, "Gabriel Genellina" wrote: > En Fri, 31 Jul 2009 13:33:45 -0300, BDZ escribió: > > > > > On Jul 30, 4:41 pm, Loïc Domaigné > > wrote: > >> > Hello. I have written a Python 3.1 script running on Windows that uses > >> > os.path.exists() to connect to network shares. If the va

Re: Seeding the rand() Generator

2009-08-06 Thread Nils Ruettershoff
Hi Fred, I just saw your SQL Statement An example would be: SELECT first, second, third, fourth, fifth, sixth from sometable order by rand() limit 1 and I feel me constrained to give you an advice. Don't use this SQL statement to pick up a random row, your user and maybe DBA would

Re: Subclassing Python's dict

2009-08-06 Thread Raymond Hettinger
> Xavier Ho wrote: > > You should subclass collections.UserDict, and not the default dict class. > > Refer to the collections module. > > Xavier, why do you think that is the correct approach? The docs say > "The need for this class has been largely supplanted by the ability to > subclass directly

Re: How to write replace string for object which will be substituted? [regexp]

2009-08-06 Thread Chris Rebert
On Thu, Aug 6, 2009 at 2:03 PM, Ryniek90 wrote: >> 2) If you really want to learn regexes, get a copy of _Mastering Regular >> Expressions_ by Friedl (either 2nd or 3rd edition) >> > > I made preview of that book, but some pages are disabled from preview. Has > that book topics about Python regexp'

Re: os.walk()

2009-08-06 Thread Chris Rebert
> On Tue, Aug 4, 2009 at 10:48 PM, Chris Rebert wrote: >> On Tue, Aug 4, 2009 at 7:06 PM, Michael Savarese wrote: >> > Greetings >> > Python newbie here, and thanks to all who have helped me previously. >> > Is there a way of grabbing file attributes while traversing with os.walk()? >> > It would

How to write replace string for object which will be substituted? [regexp]

2009-08-06 Thread Ryniek90
2) If you really want to learn regexes, get a copy of _Mastering Regular Expressions_ by Friedl (either 2nd or 3rd edition) I made preview of that book, but some pages are disabled from preview. Has that book topics about Python regexp's? If so, i must buy it. -- http://mail.python.org/ma

Re: Subclassing Python's dict

2009-08-06 Thread Raymond Hettinger
> Are you referring to Python 3.0?  Python 2.6 does not have > collections.UserDict In Python2.6, it is in its own module. >>> from UserDict import UserDict Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: Character encoding & the copyright symbol

2009-08-06 Thread Dave Angel
Robert Dailey wrote: Hello, I'm loading a file via open() in Python 3.1 and I'm getting the following error when I try to print the contents of the file that I obtained through a call to read(): UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in position 1650: character maps t

Re: Using Python to automate builds

2009-08-06 Thread Kosta
On Aug 6, 11:58 am, Piet van Oostrum wrote: > > Kosta (K) wrote: > >K> My interpretation of the above (and your email) is that using Popen > >K> allows one to pass the Python environment to a child processs (in my > >K> case, setenv.bat).   I need the reverse, to propagate from the child > >K

Re: How to write replace string for object which will be substituted? [regexp]

2009-08-06 Thread Aahz
In article , ryniek90 wrote: > >I started learning regexp, and some things goes well, but most of them >still not. 1) 'Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.' --Jamie Zawinski, comp.emacs.xemacs, 8/1997 2) If you

Re: Using Python to automate builds

2009-08-06 Thread Aahz
In article , Hendrik van Rooyen wrote: > >Bit slow - but hey, nobody's perfect. YM "pobody's nerfect" HTH HAND -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...string iteration isn't about treating strings as sequences of strings, it's about treating string

Re: Character encoding & the copyright symbol

2009-08-06 Thread Benjamin Kaplan
On Thu, Aug 6, 2009 at 12:41 PM, Robert Dailey wrote: > On Aug 6, 11:31 am, "Richard Brodie" wrote: >> "Robert Dailey" wrote in message >> >> news:29ab0981-b95d-4435-91bd-a7a520419...@b15g2000yqd.googlegroups.com... >> >> > UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in >> >

Re: pylucene installation problem on Ubuntu 9.04

2009-08-06 Thread Benjamin Kaplan
On Thu, Aug 6, 2009 at 2:49 PM, KK wrote: > > kk-laptop$ sudo apt-get install pylucene > and it did install python2.5, python2.5-minimal and pylucene. I must > mention one thing that I already had python2.6 on my box as the > default python i.e /usr/bin/python is linked to python2.6. Anyway s, > no

Re: pylucene installation problem on Ubuntu 9.04

2009-08-06 Thread Jon Clements
On 6 Aug, 19:49, KK wrote: > hi all, > I've trying to install pylucene on my linux box from last 2 days but > not able to do so. first i tried to install it using apt-get like > this, > kk-laptop$ sudo apt-get install pylucene > and it did install python2.5, python2.5-minimal and pylucene. I must

Re: Character encoding & the copyright symbol

2009-08-06 Thread Philip Semanchuk
On Aug 6, 2009, at 3:14 PM, Martin v. Löwis wrote: As a side note, you should probably use something other than "file" for the parameter name in GetFileContentsAsString() since file() is a Python function. Python 3.1.1a0 (py3k:74094, Jul 19 2009, 13:39:42) [GCC 4.3.3] on linux2 Type "help

Re: unicode() vs. s.decode()

2009-08-06 Thread Steven D'Aprano
On Thu, 06 Aug 2009 20:05:52 +0200, Thorsten Kampe wrote: > > That is significant! So the winner is: > > > > unicode('äöüÄÖÜß','utf-8') > > Unless you are planning to write a loop that decodes "äöüÄÖÜß" one > million times, these benchmarks are meaningless. What if you're writing a loop which t

Re: Web page data and urllib2.urlopen

2009-08-06 Thread Piet van Oostrum
> Dave Angel (DA) wrote: >DA> Massi wrote: >>> Hi everyone, I'm using the urllib2 library to get the html source code >>> of web pages. In general it works great, but I'm having to do with a >>> financial web site which does not provide the souce code I expect. As >>> a matter of fact if you

Re: Character encoding & the copyright symbol

2009-08-06 Thread Martin v. Löwis
> As a side note, you should probably use something other than "file" for > the parameter name in GetFileContentsAsString() since file() is a Python > function. Python 3.1.1a0 (py3k:74094, Jul 19 2009, 13:39:42) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more inform

Re: Python docs disappointing

2009-08-06 Thread Wesley Chun
On Jul 31, 1:10 pm, kj wrote: > I'm pretty new to Python, and I like a lot overall, but I find the > documentation for Python rather poor, overall. > > I'm sure that Python experts don't have this problem: kj, welcome to Python! i'm sorry that you find the documentation lacking. the one thing a

Python-URL! - weekly Python news and links (Aug 6)

2009-08-06 Thread Gabriel Genellina
QOTW: "The economy rises and falls, money comes and goes, but a great conference has permanent good effects. Well, a lot more permanent than government fiscal policy, anyway." - Python Software Foundation Director "bitter-in-victory-gracious-in-defeat-ly y'rs" timbot Is python free of "

Re: Using Python to automate builds

2009-08-06 Thread Piet van Oostrum
> Kosta (K) wrote: >K> My interpretation of the above (and your email) is that using Popen >K> allows one to pass the Python environment to a child processs (in my >K> case, setenv.bat). I need the reverse, to propagate from the child >K> to the parent. I don't think there is any modern OS

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-06 Thread Martin P. Hellwig
Thanks all for your insights and suggestions. It seems to me that there are a couple of ways to this bit manipulation and a couple of foreign modules to assist you with that. Would it be worth the while to do a PEP on this? Personally I think that it would be nice to have a standard module in

pylucene installation problem on Ubuntu 9.04

2009-08-06 Thread KK
hi all, I've trying to install pylucene on my linux box from last 2 days but not able to do so. first i tried to install it using apt-get like this, kk-laptop$ sudo apt-get install pylucene and it did install python2.5, python2.5-minimal and pylucene. I must mention one thing that I already had pyt

Re: Python docs disappointing - group effort to hire writers?

2009-08-06 Thread r
On Aug 6, 11:20 am, Paul Rubin wrote: ...(snip) > There is something similar with the PostgreSQL docs.  There is also > Real World Haskell (http://book.realworld.haskell.org) which has a lot > of interspersed user comments.  It would be cool if Python's doc site > did

Re: Character encoding & the copyright symbol

2009-08-06 Thread Nobody
On Thu, 06 Aug 2009 09:14:08 -0700, Robert Dailey wrote: > I'm loading a file via open() in Python 3.1 and I'm getting the > following error when I try to print the contents of the file that I > obtained through a call to read(): > > UnicodeEncodeError: 'charmap' codec can't encode character '\xa

Re: unicode() vs. s.decode()

2009-08-06 Thread Thorsten Kampe
* Michael Ströder (Thu, 06 Aug 2009 18:26:09 +0200) > Thorsten Kampe wrote: > > * Michael Ströder (Wed, 05 Aug 2009 16:43:09 +0200) > > I don't think any measurable speed increase will be noticeable > > between those two. > > Well, seems not to be true. Try yourself. I did (my console has UTF-8 as

Re: Unexpected side-effects of assigning to sys.modules[__name__]

2009-08-06 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: Given this module: #funny.py import sys print "Before:" print " __name__ =", __name__ print " sys.modules[__name__] =", sys.modules[__name__] sys.modules[__name__] = 123 print "After:" print " __name__ =", __name__ print " sys =", sys when I run it I get these result

Re: Help with regex

2009-08-06 Thread Nobody
On Thu, 06 Aug 2009 08:35:57 -0700, Robert Dailey wrote: > I'm creating a python script that is going to try to search a text > file for any text that matches my regular expression. The thing it is > looking for is: > > FILEVERSION #,#,#,# > > The # symbol represents any number that can be any l

Unexpected side-effects of assigning to sys.modules[__name__]

2009-08-06 Thread Steven D'Aprano
Given this module: #funny.py import sys print "Before:" print " __name__ =", __name__ print " sys.modules[__name__] =", sys.modules[__name__] sys.modules[__name__] = 123 print "After:" print " __name__ =", __name__ print " sys =", sys when I run it I get these results: [st...@sylar python]

Re: Overlap in python

2009-08-06 Thread John Ladasky
On Aug 4, 3:21 pm, Jay Bird wrote: > Hi everyone, > > I wanted to thank you all for your help and *excellent* discussion.  I > was able to utilize and embed the script by Grigor Lingl in the 6th > post of this discussion to get my program to work very quickly (I had > to do about 20 comparisons pe

Re: Using Python to automate builds

2009-08-06 Thread Kosta
On Aug 6, 3:57 am, David Cournapeau wrote: > On Thu, Aug 6, 2009 at 12:39 AM, Kosta wrote: > > > Setenv.bat sets up the path and other environment variables build.exe > > needs to compile and link (and even binplace) its utilities.  So > > building itself is not the issue.  The problem is that if

Re: Character encoding & the copyright symbol

2009-08-06 Thread Richard Brodie
"Robert Dailey" wrote in message news:f64f9830-c416-41b1-a510-c1e486271...@g19g2000vbi.googlegroups.com... > As you can see, I am trying to load the file with encoding 'cp1252' > which, according to the python 3.1 docs, translates to windows-1252. I > also tried 'latin_1', which translates to I

Re: Character encoding & the copyright symbol

2009-08-06 Thread Philip Semanchuk
On Aug 6, 2009, at 12:41 PM, Robert Dailey wrote: On Aug 6, 11:31 am, "Richard Brodie" wrote: "Robert Dailey" wrote in message news:29ab0981-b95d-4435-91bd-a7a520419...@b15g2000yqd.googlegroups.com ... UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in position 1650: c

Re: Character encoding & the copyright symbol

2009-08-06 Thread Albert Hopkins
On Thu, 2009-08-06 at 09:14 -0700, Robert Dailey wrote: > Hello, > > I'm loading a file via open() in Python 3.1 and I'm getting the > following error when I try to print the contents of the file that I > obtained through a call to read(): > > UnicodeEncodeError: 'charmap' codec can't encode char

Re: Help with regex

2009-08-06 Thread Robert Dailey
On Aug 6, 11:12 am, Roman wrote: > On 06/08/09 08:35, Robert Dailey wrote: > > > > > > > Hey guys, > > > I'm creating a python script that is going to try to search a text > > file for any text that matches my regular expression. The thing it is > > looking for is: > > > FILEVERSION #,#,#,# > > >

Re: Character encoding & the copyright symbol

2009-08-06 Thread Robert Dailey
On Aug 6, 11:31 am, "Richard Brodie" wrote: > "Robert Dailey" wrote in message > > news:29ab0981-b95d-4435-91bd-a7a520419...@b15g2000yqd.googlegroups.com... > > > UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in > > position 1650: character maps to > > > The file is defined a

Re: Using easy_install, reduncant?

2009-08-06 Thread Adam N
On Jul 27, 7:53 pm, David Lyon wrote: > On Mon, 27 Jul 2009 09:42:06 -0700 (PDT), ray > wrote: > > > I am working on a Trac installation.  I am new to Python.  To install > > packages, it is suggested to use setuptools.  I have not understood > > the directions. > > > I execute ez_install.py. > >

Re: Two Dimensional Array + ctypes

2009-08-06 Thread Sparky
On Aug 5, 11:19 pm, "Gabriel Genellina" wrote: > En Wed, 05 Aug 2009 20:12:09 -0300, Sparky escribió: > > > > > > > Hello! I am trying to call this method: > > > long _stdcall AIBurst(long *idnum, [...] > >                     long timeout, > >                     float (*voltages)[4], > >      

Re: Help with regex

2009-08-06 Thread Roman
On 06/08/09 08:35, Robert Dailey wrote: > Hey guys, > > I'm creating a python script that is going to try to search a text > file for any text that matches my regular expression. The thing it is > looking for is: > > FILEVERSION #,#,#,# > > The # symbol represents any number that can be any leng

Re: Character encoding & the copyright symbol

2009-08-06 Thread Richard Brodie
"Robert Dailey" wrote in message news:29ab0981-b95d-4435-91bd-a7a520419...@b15g2000yqd.googlegroups.com... > UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in > position 1650: character maps to > > The file is defined as ASCII. That's the problem: ASCII is a seven bit code.

Re: Help with regex

2009-08-06 Thread MRAB
Robert Dailey wrote: On Aug 6, 11:02 am, MRAB wrote: Robert Dailey wrote: Hey guys, I'm creating a python script that is going to try to search a text file for any text that matches my regular expression. The thing it is looking for is: FILEVERSION #,#,#,# The # symbol represents any number th

Re: Character encoding & the copyright symbol

2009-08-06 Thread Philip Semanchuk
On Aug 6, 2009, at 12:14 PM, Robert Dailey wrote: Hello, I'm loading a file via open() in Python 3.1 and I'm getting the following error when I try to print the contents of the file that I obtained through a call to read(): UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in

Re: unicode() vs. s.decode()

2009-08-06 Thread Michael Ströder
Thorsten Kampe wrote: > * Michael Ströder (Wed, 05 Aug 2009 16:43:09 +0200) >> These both expressions are equivalent but which is faster or should be >> used for any reason? >> >> u = unicode(s,'utf-8') >> >> u = s.decode('utf-8') # looks nicer > > "decode" was added in Python 2.2 for the sake of

Re: Python docs disappointing - group effort to hire writers?

2009-08-06 Thread Paul Rubin
alex23 writes: > No offence, but the last thing the official documentation needs is > example code written by people learning how to code. Suggest changes, > request clarifications, submit samples for review, sure, but direct > modification by users? I've seen the PHP docs; thanks but no thanks.

Re: Web page data and urllib2.urlopen

2009-08-06 Thread ryles
On Aug 5, 4:30 pm, Massi wrote: > Hi everyone, I'm using the urllib2 library to get the html source code > of web pages. In general it works great, but I'm having to do with a > financial web site which does not provide the souce code I expect. As > a matter of fact if you try: > > import urllib2

Re: Help with regex

2009-08-06 Thread Robert Dailey
On Aug 6, 11:02 am, MRAB wrote: > Robert Dailey wrote: > > Hey guys, > > > I'm creating a python script that is going to try to search a text > > file for any text that matches my regular expression. The thing it is > > looking for is: > > > FILEVERSION #,#,#,# > > > The # symbol represents any nu

Re: How to comment on a Python PEP?

2009-08-06 Thread Robert Kern
On 2009-08-06 03:42, "Martin v. Löwis" wrote: Is there a mechanism for submitting comments on a Python PEP? You post to python-dev or comp.lang.python, and you CC the author. And be sure to put the PEP number in the Subject: line. -- Robert Kern "I have come to believe that the whole world

Character encoding & the copyright symbol

2009-08-06 Thread Robert Dailey
Hello, I'm loading a file via open() in Python 3.1 and I'm getting the following error when I try to print the contents of the file that I obtained through a call to read(): UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in position 1650: character maps to The file is defined

Re: Help with regex

2009-08-06 Thread alex23
On Aug 7, 1:35 am, Robert Dailey wrote: > I'm creating a python script that is going to try to search a text > file for any text that matches my regular expression. The thing it is > looking for is: > > FILEVERSION 1,45,10082,3 Would it be easier to do it without regex? The following is untested

Re: Help with regex

2009-08-06 Thread MRAB
Robert Dailey wrote: Hey guys, I'm creating a python script that is going to try to search a text file for any text that matches my regular expression. The thing it is looking for is: FILEVERSION #,#,#,# The # symbol represents any number that can be any length 1 or greater. Example: FILEVERS

Re: Python docs disappointing - group effort to hire writers?

2009-08-06 Thread alex23
Kee Nethery wrote: > As I struggle through trying to figure out how to make python do   > simple stuff for me, I frequently generate samples. If some volunteer   > here would point me towards the documentation that would tell me how I   > can alter the existing Python docs to include sample code, I

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-06 Thread IronyOfLife
Hi Gabriel On Aug 5, 4:18 pm, "Gabriel Genellina" wrote: > En Tue, 04 Aug 2009 10:15:24 -0300, IronyOfLife > escribió: > > > On Aug 3, 8:42 pm, "Gabriel Genellina" wrote: > >> En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLife   > >> escribió: > > >> > I have installed python 2.6.2 in windows xp

Help with regex

2009-08-06 Thread Robert Dailey
Hey guys, I'm creating a python script that is going to try to search a text file for any text that matches my regular expression. The thing it is looking for is: FILEVERSION #,#,#,# The # symbol represents any number that can be any length 1 or greater. Example: FILEVERSION 1,45,10082,3 The r

Re: ANN: Python for Bioinformatics book

2009-08-06 Thread Sebastian Bassi
On Thu, Aug 6, 2009 at 11:52 AM, Bearophile wrote: > The book looks interesting, but that doesn't look like a good way to > show/offer the code. I suggest to also put it into a zip that can be > downloaded. Code is also in a directory in the DVD and also inside the virtual machine. Anyway I think

Re: ANN: Python for Bioinformatics book

2009-08-06 Thread Bearophile
Sebastian Bassi: > All code is also available at thehttp://py3.us/##where ## is the code number, > for example:http://py3.us/57< The book looks interesting, but that doesn't look like a good way to show/offer the code. I suggest to also put it into a zip that can be downloaded. Bye, bearophile

Help making this script better

2009-08-06 Thread jakecjacobson
Hi, After much Google searching and trial & error, I was able to write a Python script that posts XML files to a REST API using HTTPS and passing PEM cert & key file. It seems to be working but would like some pointers on how to handle errors. I am using Python 2.4, I don't have the capability t

ANN: Python for Bioinformatics book

2009-08-06 Thread Sebastian Bassi
"Python for Bioinformatics" ISBN 1584889292 Amazon: http://www.tinyurl.com/biopython Publisher: http://www.crcpress.com/product/isbn/9781584889298 This book introduces programming concepts to life science researchers, bioinformaticians, support staff, students, and everyone who is interested in ap

Re: Python docs disappointing - group effort to hire writers?

2009-08-06 Thread Kee Nethery
On Aug 6, 2009, at 6:55 AM, Terry Reedy wrote: RayS wrote: At 08:35 PM 8/5/2009 -0700, r wrote: """... Any real sense of community is undermined -- or even destroyed -- to be replaced by virtual equivalents that strive, unsuccessfully, to synthesize a sense of community.""" I've brought up th

Re: unicode() vs. s.decode()

2009-08-06 Thread Thorsten Kampe
* Michael Ströder (Wed, 05 Aug 2009 16:43:09 +0200) > These both expressions are equivalent but which is faster or should be > used for any reason? > > u = unicode(s,'utf-8') > > u = s.decode('utf-8') # looks nicer "decode" was added in Python 2.2 for the sake of symmetry to encode(). It's esse

Re: unicode() vs. s.decode()

2009-08-06 Thread Jason Tackaberry
On Thu, 2009-08-06 at 01:31 +, John Machin wrote: > Faster by an enormous margin; attributing this to the cost of attribute lookup > seems implausible. Ok, fair point. I don't think the time difference fully registered when I composed that message. Testing a global access (LOAD_GLOBAL) versu

  1   2   >