Invalid syntax with print "Hello World"

2009-03-12 Thread Henrik Bechmann
obviously total mewbiew: My first program in Python Windows print "Hello World" I select Run/Run Module and get an error: Syntax error, with the closing quote highlighted. Tried with single quotes as well. Same problem. Can someone explain my mistake? Thanks, - Henrik -- http://mail.python.

Re: NameError: name 'execfile' is not defined

2009-03-12 Thread Gary Herron
Henrik Bechmann wrote: Newbie issue: I downloaded http://www.python.org/download/releases/3.0.1/ (windows insaller), opened the interpreter, wrote a print "Hello World" program in helloworld.py, and in the interpreter typed execfile("helloworld.py") Got back NameError: name 'execfile' is not

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Gary Herron
Henrik Bechmann wrote: obviously total mewbiew: My first program in Python Windows print "Hello World" I select Run/Run Module and get an error: Syntax error, with the closing quote highlighted. Tried with single quotes as well. Same problem. Can someone explain my mistake? You are app

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Daniel Fetchinson
> obviously total mewbiew: > > My first program in Python Windows > > print "Hello World" > > I select Run/Run Module and get an error: > > Syntax error, with the closing quote highlighted. > > Tried with single quotes as well. Same problem. > > Can someone explain my mistake? Are you using python

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread John Machin
On Mar 12, 5:57 pm, Henrik Bechmann wrote: > obviously total mewbiew: > > My first program in Python Windows What is that you are callind "Python Windows"? What version of Python are you running? 2.X: print "Hello World" should work. 3.X: print is now a function, print("Hello World") should wor

Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Raymond Hettinger
If anyone here is interested, here is a proposal I posted on the python-ideas list. The idea is to make numbering formatting a little easier with the new format() builtin in Py2.6 and Py3.0: http://docs.python.org/library/string.html#formatspec --

Re: Question on periods in strings

2009-03-12 Thread Gabriel Genellina
En Wed, 11 Mar 2009 23:42:45 -0200, Philip Bloom escribió: Thanks for the welcome :) You're right. Here's with the missed line (I was cutting out commented parts). Hopefully these are all cut/paste-able. #test A #runs in 5.8 seconds. from datetime import datetime testvar2='9a00' startT

Re: wxPython fast and slow

2009-03-12 Thread David Bolen
iu2 writes: > A question about CallAfter: As I understand, this function is intended > to be used from within threads, where it queues the operation to be > performed in the GUI queue. I agree with the second half of the sentence but not the first. CallAfter is intended to queue up a delayed cal

Re: Stopping SocketServer on Python 2.5

2009-03-12 Thread Mark Tolonen
"Falcolas" wrote in message news:1b6a95a4-5680-442e-8ad0-47aa9ea08...@w1g2000prk.googlegroups.com... On Mar 11, 1:11 pm, David George wrote: Again, problem here is the issue of being unable to kill the server while it's waiting on a request. In theory, i could force it to continue by sending

Re: Question on periods in strings

2009-03-12 Thread John Machin
On Mar 12, 12:42 pm, "Philip Bloom" wrote: > The range is not actually a meaningful adjustment as the time results are > identical switching out xrange (as I believe they should be since in 2.6 > range maps to xrange for the most part according to some of the docs).   Please do import sys;

Re: Read a content file from a P7M

2009-03-12 Thread Luca
On Wed, Mar 11, 2009 at 5:05 PM, Luca wrote: > There is standard or sugested way in python to read the content of a P7M file? > > I don't need no feature like verify sign, or sign using a certificate. > I only need to extract the content file of the p7m (a doc, a pdf, ...) I'm there again! I fou

Re: A Dangling Tk Entry

2009-03-12 Thread r
On Mar 11, 1:09 am, Marc 'BlackJack' Rintsch wrote: > Then he did it consequently wrong.  `frame_delay` is always `None` here > so the ``return`` is useless. > > You asked what this code means and now you don't like the answer that > it's somewhat useless code!? > > Ciao, >         Marc 'BlackJac

Re: What happened to NASA at Python? :(

2009-03-12 Thread Michele Simionato
On Mar 12, 4:26 am, r wrote: > On Mar 11, 10:09 pm, s...@pobox.com wrote: > > > In fact, graphics were added for several organizations.  I believe they will > > be chosen randomly.  NASA is still there. > > > --http://mail.python.org/mailman/listinfo/python-list > > Whew! Thats good news, i though

Re: What happened to NASA at Python? :(

2009-03-12 Thread Mikael Olofsson
s...@pobox.com wrote: In fact, graphics were added for several organizations. I believe they will be chosen randomly. NASA is still there. In that case, they must be using the random number generator from Dilbert. You know, the one that said 9, 9, 9, 9,... I, at least, get the same parking

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Raymond Hettinger
> If anyone here is interested, here is a proposal I posted on the > python-ideas list. > > The idea is to make numbering formatting a little easier with > the new format() builtin: > http://docs.python.org/library/string.html#formatspec Here's a re-post (hopefully without the line wrapping proble

PythonWin, python thread and PostQuitMessage?

2009-03-12 Thread arnaud
Hi All, I'm not so much involved in any Windows programming however I needed to write a client for the Windows platform. I have this very simple question which I've been unable to answer. I'm listening for keyboard strokes using the pyhook library. I'm doing this in a dedicated thread. The gui jus

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Ulrich Eckhardt
Raymond Hettinger wrote: >> The idea is to make numbering formatting a little easier with >> the new format() builtin: >> http://docs.python.org/library/string.html#formatspec [...] > Scanning the web, I've found that thousands separators are > usually one of COMMA, PERIOD, SPACE, or UNDERSCORE. T

__import__ with dict values

2009-03-12 Thread alex goretoy
How would I import with __import__ from dict values? I want sys.path value inside d['syspath'], below code doesn't work for me d={} d['sys']='sys' d['path']='path' d['syspath']=__import__(d['sys'],fromlist=[d['path']]) and how come does above line doesn't give me diff value than below line? d

Re: What happened to NASA at Python? :(

2009-03-12 Thread James Matthews
>From what I see most startups are jumping to Python to rapidly setup their prototypes. On Thu, Mar 12, 2009 at 10:38 AM, Mikael Olofsson wrote: > s...@pobox.com wrote: > >> In fact, graphics were added for several organizations. I believe they >> will >> be chosen randomly. NASA is still ther

Re: What happened to NASA at Python? :(

2009-03-12 Thread Dotan Cohen
> I, at least, get the same parking lot graphics every time I reload the page. > If you click "and more" link, you will come to a page of success stories, one of which is this: http://python.org/about/success/usa/ It is not as prominent as the earlier Nasa logo, though. -- Dotan Cohen http://w

Re: c.Win32_OperatingSystem question.

2009-03-12 Thread bryan rasmussen
Hi, well coming back to the project and looking over it I realized I had somehow messed up the names for some Win32 Operating System properties - for example ComputerOrganization instead of Organization. Not sure where I got the values from cause I've just be copying the properties I want from scr

Re: Question on periods in strings

2009-03-12 Thread Bruno Desthuilliers
Philip Bloom a écrit : (snip) from datetime import datetime startTime = datetime.now() (snip) print (datetime.now() - startTime) A bit OT, but you may want to use timeit.Timer for this kind of microbenchmarks. (snip) -- http://mail.python.org/mailman/listinfo/python-list

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
I have resolved this problem in my code. It has something to do with your current working directory when you append cwd/jars to sys.path and try to import from interactive console -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 4:58 AM, alex goretoy wrote: > How would I import with

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
yay, no more exec ("import " + "sys") in my code -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 5:42 AM, alex goretoy wrote: > I have resolved this problem in my code. It has something to do with your > current working directory when you append cwd/jars to sys.path and try to >

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
or eval for that matter -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 5:43 AM, alex goretoy wrote: > yay, no more > > exec ("import " + "sys") > > in my code > > -Alex Goretoy > http://www.goretoy.com > > > > On Thu, Mar 12, 2009 at 5:42 AM, alex goretoy > wrote: > >> I have res

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
note i would still like to be able to do __import__("sys")."path" maybe if __import__ had __str__ defined, How is my thinking on this? and how would I achieve something like this? -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 5:44 AM, alex goretoy wrote: > or eval for that matte

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread steven.oldner
On Mar 12, 2:25 am, John Machin wrote: > On Mar 12, 5:57 pm, Henrik Bechmann wrote: > > > obviously total mewbiew: > > > My first program in Python Windows > > What is that you are callind "Python Windows"? What version of Python > are you running? > > 2.X: print "Hello World" > should work. > >

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
__import__(opt['imp_mod']).options eval(opt['imp_mod']+"."+opt['imp_opt']) how to make top work like bottom? -Alex Goretoy http://www.goretoy.com On Thu, Mar 12, 2009 at 5:56 AM, alex goretoy wrote: > note i would still like to be able to do __import__("sys")."path" > > maybe if __import__ ha

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Dotan Cohen
> Welcome to the list.  As a newbie myself, I ran into the Python3 vrs > 2.6 issue.  May I suggest starting with 2.6?  There is many more books > and internet stuff you can learn with in 2.6 - and the examples will > work. As Garry wrote, once you understand 2.6, 3.0 will not be a > challenge. > I

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Raymond Hettinger
[Ulrich Eckhardt] > IOW, why not explicitly say what you want using keyword arguments with > defaults instead of inventing an IMHO cryptic, read-only mini-language? That makes sense to me but I don't think that's the way the format() builtin was implemented (see PEP 3101 which was implemented Py2.

Input data from .txt file and object array problem

2009-03-12 Thread SamuelXiao
I want to input data by using pickle First of all, I have a database.txt The content is like: AAA,aaalink BBB,bbblink CCC,ccclink ...,... AAA,BBB,CCC is Language name, and aaalink,bbblink,ccclink is their respective link. I want to store data by using pickle. Meanwhile , I got a problem. #I have

Re: What happened to NASA at Python? :(

2009-03-12 Thread skip
>> If they were so keen on new graphics, why did 2.6 revert >> to the same icons that 2.4 used? (At least they did on my >> machine. After installing 2.6, I no longer had the new >> 2.5 icons but had reverted to the earlier ones.) Can you be more specific? Is this a Windows thing

cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Vlastimil Brom
Hi all, I'd like to ask for some advice on how to acomplish file access in a cross platform way. My application is a kind of viewer of text and corresponding image files (stored in separate subdirectories) and I'm going to deploy it as binaries for windows and source files (again in separate direct

Re: Building python 64-bit on OS 10.5?

2009-03-12 Thread Dan Yamins
Dear all: I've two questions: 1) I've been trying to building python as a 64-bit version on OS 10.5. I'm not too familiar with building python from scratch, and a number of basic attempts made from piecing together things I've seen on the web have failed. (For instance, ./configure --ena

multiprocessing + atexit

2009-03-12 Thread Neal Becker
I have some code that uses atexit (remove old log files). Before converting to use multiprocessing, it worked. Since converting, it seems to not be running the atexit code (old log files are not removed). Any known issues with multiprocessing + atexit? -- http://mail.python.org/mailman/listi

Re: Question on periods in strings

2009-03-12 Thread skip
Gabriel> I could not reproduce this. Nor can I. I didn't see the original post. What were the hardware parameters and Python version? -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: What happened to NASA at Python? :(

2009-03-12 Thread skip
>> In fact, graphics were added for several organizations. I believe >> they will be chosen randomly. NASA is still there. MiO> In that case, they must be using the random number generator from MiO> Dilbert. You know, the one that said 9, 9, 9, 9,... Sorry, randomly chosen when

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Mike Mazurek
You might want to look at the path module: http://pypi.python.org/pypi/path.py/2.2 It will probably make your code more readable. On Thu, Mar 12, 2009 at 8:10 AM, Vlastimil Brom wrote: > Hi all, > I'd like to ask for some advice on how to acomplish file access in a > cross platform way. > My ap

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread MRAB
Raymond Hettinger wrote: [snip] Proposal I (from Nick Coghlan): --- A comma will be added to the format() specifier mini-language: [[fill]align][sign][#][0][minimumwidth][,][.precision][type] The ',' option indicates that commas should be included in the output as a

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Hendrik van Rooyen
"Ulrich Eckhardt" wrote: >IOW, why not explicitly say what you want using keyword arguments with >defaults instead of inventing an IMHO cryptic, read-only mini-language? >Seriously, the problem I see with this proposal is that its aim to be as >short as possible actually makes the resulting forma

loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Poor Yorick
In the following snippet, the loop in the global namespace takes twice as long as the loop in the function namespace. Why? limit = 5000 def f1(): counter = 0 while counter < limit: counter += 1 time1 = time.time() f1() print(time.time() - time

Re: [Tutor] loop performance in global namespace (python-2.6.1)

2009-03-12 Thread spir
Le Thu, 12 Mar 2009 11:13:33 -0400, Kent Johnson s'exprima ainsi: > Because local name lookup is faster than global name lookup. Local > variables are stored in an array in the stack frame and accessed by > index. Global names are stored in a dict and accessed with dict access > (dict.__getitem__

Re: Input data from .txt file and object array problem

2009-03-12 Thread odeits
On Mar 12, 5:03 am, SamuelXiao wrote: > I want to input data by using pickle > First of all, I have a database.txt > The content is like: > > AAA,aaalink > BBB,bbblink > CCC,ccclink > ...,... > > AAA,BBB,CCC is Language name, and aaalink,bbblink,ccclink is their > respective link. > I want to stor

Re: can python import class or module directly from a zip package

2009-03-12 Thread Coonay
On Mar 11, 9:47 pm, Lorenzo wrote: > On Mar 10, 2:13 pm, Flank wrote: > > > can python import class or  module directly from  a zip package ,just > > like jave does from jar package without extracting the class file into > > directory > > > so far as i know ,python module should be unzip to file

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread John Machin
On Mar 12, 9:56 pm, Raymond Hettinger wrote: > [Ulrich Eckhardt] > > > IOW, why not explicitly say what you want using keyword arguments with > > defaults instead of inventing an IMHO cryptic, read-only mini-language? > > That makes sense to me but I don't think that's the way the format() > built

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Paul Boddie
On 12 Mar, 12:45, Dotan Cohen wrote: > [starting with 2.6] > I do not think that is the best way to go about learning Python. Why > learn an arguably depreciating version when the new version is > available. I agree that there are not many tutorial written for Python > 3 however there are enough

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Henrik Bechmann
On Mar 12, 7:45 am, Dotan Cohen wrote: > > Welcome to the list.  As a newbie myself, I ran into the Python3 vrs > > 2.6 issue.  May I suggest starting with 2.6?  There is many more books > > and internet stuff you can learn with in 2.6 - and the examples will > > work. As Garry wrote, once you und

Re: NameError: name 'execfile' is not defined

2009-03-12 Thread Henrik Bechmann
On Mar 12, 3:15 am, Gary Herron wrote: > Henrik Bechmann wrote: > > Newbie issue: > > > I downloadedhttp://www.python.org/download/releases/3.0.1/(windows > > insaller), opened the interpreter, wrote a print "Hello World" program > > in helloworld.py, and in the interpreter typed > > > execfile("h

Re: Stopping SocketServer on Python 2.5

2009-03-12 Thread David George
On 2009-03-12 08:03:06 +, "Mark Tolonen" said: "Falcolas" wrote in message news:1b6a95a4-5680-442e-8ad0-47aa9ea08...@w1g2000prk.googlegroups.com... On Mar 11, 1:11 pm, David George wrote: Again, problem here is the issue of being unable to kill the server while it's waiting on a reque

How to send an email with GMail in Python from Windows

2009-03-12 Thread ∂ √ ¡ ŋ ∂ ♪ ђ
Hi Can somebody help me with sending an email using Python from GMail Here's what I tried but it fails always. import smtplib import base64 smtpserver = 'smtp.gmail.com' AUTHREQUIRED = 0 # if you need to use SMTP AUTH set to 1 s

Re: How to send an email with GMail in Python from Windows

2009-03-12 Thread dorzey
You might want to try - http://libgmail.sourceforge.net/. This is a Python binding for GMail; I've used it a little and it did the job for me. Dorzey -- http://mail.python.org/mailman/listinfo/python-list

Re: How to send an email with GMail in Python from Windows

2009-03-12 Thread gordyt
Howdy Avinash, Here is a simple example for you. from smtplib import SMTP HOST = "smtp.gmail.com" PORT = 587 ACCOUNT = ""# put your gmail email account here PASSWORD = "" # put your gmail email password here def send_email(to_addrs, subject, msg): server = SMTP(HOST,PORT) s

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread pruebauno
On Mar 12, 3:30 am, Raymond Hettinger wrote: > If anyone here is interested, here is a proposal I posted on the > python-ideas list. > > The idea is to make numbering formatting a little easier with the new > format() builtin > in Py2.6 and Py3.0:  http://docs.python.org/library/string.html#format

default shelve on linux corrupts, does different DB system help?

2009-03-12 Thread Paul Sijben
I have the problem that my shelve(s) sometimes corrupt (looks like it has after python has run out of threads). I am using the default shelve so on linux I get the dbhash version. Is there a different DB type I can choose that is known to be more resilient? And if so, what is the elegant way of do

Re: Input data from .txt file and object array problem

2009-03-12 Thread Piet van Oostrum
> SamuelXiao (S) wrote: >S> I want to input data by using pickle >S> First of all, I have a database.txt >S> The content is like: >S> AAA,aaalink >S> BBB,bbblink >S> CCC,ccclink >S> ...,... >S> AAA,BBB,CCC is Language name, and aaalink,bbblink,ccclink is their >S> respective link. >S> I wan

Re: Killing subservient threads

2009-03-12 Thread Aahz
In article , Christian Heimes wrote: >Gabriel Genellina wrote: >> >> 1) make the child window set a flag in the thread (let's say, >> t.terminate = True). And make the polling thread check the flag >> periodically (you possibly already have a loop there - just break the >> loop when you detect th

question on msvcrt.dll versioning

2009-03-12 Thread rogerdpack
It appears from sites like http://www.develer.com/oss/GccWinBinaries at the bottom that at least this developer made an effort to link against the same version of msvcrt.dll that the python exe was compiled with [ex: vc2008 -> msvcr90.dll]. Is this pain necessary? Are there known drawbacks to not

Re: pymssql text type

2009-03-12 Thread Aahz
[posted and e-mailed, please reply to group] In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>, marc wyburn wrote: >Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the >follwoing error. > >(, OperationalError("SQL Server >message 102, severity 15, st

Re: "import" not working?

2009-03-12 Thread Aahz
In article , Rhodri James wrote: > >Just so that we're clear, this is a *really* *bad* habit to get into. >Not appending to sys.path, though that isn't often a good idea, but >failing to escape your backslashes. This works because '\D' happens >not to be a valid escape sequence: if your directory

Re: how to assert that method accepts specific types

2009-03-12 Thread Aahz
In article <3f26a2f1-94cf-4083-9bda-7076959ad...@k19g2000yqg.googlegroups.com>, Darren Dale wrote: > >class Test(object): >@accepts(int) >def check(self, obj): >print obj > >t = Test() >t.check(1) > >but now I want Test.check to accept an instance of Test as well. Does >anyone kno

Re: Input data from .txt file and object array problem

2009-03-12 Thread SamuelXiao
On Mar 12, 11:17 pm, Piet van Oostrum wrote: > > SamuelXiao (S) wrote: > >S> I want to input data by using pickle > >S> First of all, I have a database.txt > >S> The content is like: > >S> AAA,aaalink > >S> BBB,bbblink > >S> CCC,ccclink > >S> ...,... > >S> AAA,BBB,CCC is Language name, and aa

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Raymond Hettinger
On Mar 12, 7:51 am, prueba...@latinmail.com wrote: > On Mar 12, 3:30 am, Raymond Hettinger wrote: > > > > > If anyone here is interested, here is a proposal I posted on the > > python-ideas list. > > > The idea is to make numbering formatting a little easier with the new > > format() builtin > > i

Python/Django forum-building software Snap/SCT, any reviews?

2009-03-12 Thread John Crawford
I'm looking for good open-source software for forums. There is a *lot* out there, for instance Lussumo's Vanilla gets good reviews, but most are PHP-based, and I would obviously prefer to use Python, with or without Django. Two packages that are Django-based that I have found, are Snap and SCT.

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Paul Rubin
Raymond Hettinger writes: > FWIW, posted a cleaned-up version of the proposal at > http://www.python.org/dev/peps/pep-0378/ It would be nice if the PEP included a comparison between the proposed scheme and how it is done in other programs and languages. For example, I think Common Lisp has a f

Re: python contextmanagers and ruby blocks

2009-03-12 Thread Aahz
In article , Alia K wrote: >Aahz wrote: >> >> Longer answer: the way in Python to achieve the full power of Ruby >> blocks is to write a function. > >You are most likely right... there is probably no need to introduce >ruby-like blocks to python where iteration comes naturally with list >comprehe

PyCon Update

2009-03-12 Thread Raymond Hettinger
As of today, we still have rooms at the Hyatt. If you haven't registered yet and want to attend, it is not sold out. http://us.pycon.org/2009/ Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Raymond Hettinger
[Paul Rubin] > It would be nice if the PEP included a comparison between the proposed > scheme and how it is done in other programs and languages. Good idea. I'm hoping that people will post those here. In my quick research, it looks like many languages offer nothing more than the usual C style %

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Luis Zarrabeitia
On Thursday 12 March 2009 07:45:55 am Dotan Cohen wrote: > I do not think that is the best way to go about learning Python. Why > learn an arguably depreciating version when the new version is > available. Because it is not only the language that matters, you also need the libraries to accomplis

Re: ipython / vs \ in readline on MS Windows (and ipython help grepper)

2009-03-12 Thread Jason Scheirer
On Mar 10, 3:34 pm, bdb112 wrote: > Q1/ I run a standard python ditribution with ipython and readline > under cygwin.  The tab filename completion works fine in the OS (bash > shell) as expected, and tab filename completion at the ipython command > line works, but with MS style path separators (ba

Re: Candidate for a new itertool

2009-03-12 Thread pruebauno
On Mar 7, 8:47 pm, Raymond Hettinger wrote: > The existing groupby() itertool works great when every element in a > group has the same key, but it is not so handy when groups are > determined by boundary conditions. > > For edge-triggered events, we need to convert a boundary-event > predicate to

Re: PythonWin, python thread and PostQuitMessage?

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 07:21:35 -0200, escribió: I'm not so much involved in any Windows programming however I needed to write a client for the Windows platform. I have this very simple question which I've been unable to answer. I'm listening for keyboard strokes using the pyhook library. I'm doin

Re: "Byte" type?

2009-03-12 Thread Scott David Daniels
John Nagle wrote: Martin v. Löwis wrote: Please don't call something dumb that you don't fully understand ...- do you have to convert twice? Depends on how you write your code. If you use the bytearray type (which John didn't, despite his apparent believe that he did), then no conversion a

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Raymond Hettinger
[Paul Rubin] > I think Common Lisp has a feature for formatting thousands. I found the Common Lisp spec for this and added it to the PEP. Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: "import" not working?

2009-03-12 Thread Scott David Daniels
Aahz wrote: In article , Rhodri James wrote: ... sys.path.append("C:\\DataFileTypes") My preference: sys.path.append(r"C:\DataFileTypes") This doesn't work if you need to add a trailing backslash, though. Also my preference (except, due to aging eyes and bad fonts, I prefer single quotes un

Re: Python 2.7 MSI / pywin32 snapshots [was: Windows install to custom location ...]

2009-03-12 Thread Scott David Daniels
Tim Golden wrote: Scott David Daniels wrote: Tim Golden wrote: ... Anyhow, at the end I have a working Python 2.7a0 running under Windows. Do you mean 3.1a0? As far as I know, 2.7a0 requires the use of the time machine, as it is expected to be 3 months out. If you do get an installer built,

Raw String Question

2009-03-12 Thread Jim Garrison
I'm an experienced Perl developer learning Python, but I seem to be missing something about raw strings. Here's a transcript of a Python shell session: Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more infor

Re: __import__ with dict values

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 09:27:35 -0200, alex goretoy escribió: note i would still like to be able to do __import__("sys")."path" p = __import__("sys").path That's a convoluted way of doing: import sys p = sys.path (except that the latter one inserts "sys" in the current namespace) maybe if

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Paul Rubin
Raymond Hettinger writes: > In my quick research, it looks like many languages offer > nothing more than the usual C style % formatting and defer > the rest for a local aware module. Hendrik van Rooyen's mention of Cobol's "picture" (aka PIC) specifications might be added to the list. Cautionary

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Paul Rubin
Raymond Hettinger writes: > I found the Common Lisp spec for this and added it to the PEP. Ah, cool, I simultaneously looked for it and posted about it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Raw String Question

2009-03-12 Thread Tim Chase
>>> r"a\" SyntaxError: EOL while scanning string literal (, line 1) It seems the parser is interpreting the backslash as an escape character in a raw string if the backslash is the last character. Is this expected? Yep...as documented[1], "even a raw string cannot end in an odd number of b

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread Scott David Daniels
Raymond Hettinger wrote: <... a generally interesting PEP...> Missing from this PEP: output below the decimal point. show results for something like: format(12345.54321, "15,.5f") --> ' 12,345.543,21' Explain the interaction on sizes and lengths (which numbers are digits, which are length [

Re: Building python 64-bit on OS 10.5?

2009-03-12 Thread Ned Deily
In article <15e4667e0903121005v74d8e971ve57add393cf90...@mail.gmail.com>, > I've two questions: > > 1) I've been trying to building python as a 64-bit version on OS 10.5. > I'm not too familiar with building python from scratch, and a number of > basic attempts made from piecing together things

Re: Minimilistic Python on Linux?

2009-03-12 Thread Royce Wilson
Thanks, much better. What exactly do I lose when I launch python without site.py? On Wed, Mar 11, 2009 at 10:27 PM, Gabriel Genellina wrote: > En Thu, 12 Mar 2009 00:41:18 -0200, Royce Wilson > escribió: > >> On Wed, Mar 11, 2009 at 9:33 PM, Royce Wilson wrote: >> >> Thanks for the quick respo

Re: loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Duncan Booth
Poor Yorick wrote: > In the following snippet, the loop in the global namespace takes twice > as long as the loop in the function namespace. Why? > Accessing global variables is generally slower than accessing local variables. Locals are effectively stored in a vector so the bytecode can go s

Re: loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Scott David Daniels
Poor Yorick wrote: In the following snippet, the loop in the global namespace takes twice as long as the loop in the function namespace. Why? Locals are known to have no outside interaction, and so are not looked up by name. your code could have a thread that did, global counter

Re: What happened to NASA at Python? :(

2009-03-12 Thread r
On Mar 12, 3:31 am, Michele Simionato wrote: > That's pretty much impossible. I am sure NASA uses all programming > languages in existence, > plus probably many internal ones we never heard of. True but... >>> all([NASA.does_endorse(lang) for lang in NASA['languages']]) False As the code sugge

Re: Raw String Question

2009-03-12 Thread Jim Garrison
Tim Chase wrote: >>> r"a\" SyntaxError: EOL while scanning string literal (, line 1) It seems the parser is interpreting the backslash as an escape character in a raw string if the backslash is the last character. Is this expected? Yep...as documented[1], "even a raw string cannot end in a

Re: Raw String Question

2009-03-12 Thread Nick Craig-Wood
Jim Garrison wrote: > >>> r"a\b" >'a\\b' > >>> r"a\" >SyntaxError: EOL while scanning string literal (, line 1) > >>> r"a\ " >'a\\ ' > >>> r"a\"" >'a\\"' > > It seems the parser is interpreting the backslash as an escape > character in a raw string if the backslash is th

RE: Question on periods in strings

2009-03-12 Thread Philip Bloom
Thanks. I now know the cause of this, the suggestion to fling it in a few languages made it obvious. All of them were sharing the issue. Specifically that Trend MicroOffice Scan was the stalling factor, which was significantly boosting write times and if the write had any periods it would sen

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Vlastimil Brom
> On Thu, Mar 12, 2009 at 8:10 AM, Vlastimil Brom > wrote: >> >> Hi all, >> I'd like to ask for some advice on how to acomplish file access in a >> cross platform way. >> ... >> Any hints or comments are much appreciated; thanks in advance! >> >> regards, >>   Vlasta 2009/3/12 Mike Mazurek : > Y

Re: Raw String Question

2009-03-12 Thread Duncan Booth
Jim Garrison wrote: > OK, I'm curious as to the reasoning behind saying that > > When an 'r' or 'R' prefix is present, a character following a > backslash is included in the string without change, and all > backslashes are left in the string. > > which sounds reasonable, but then sa

Re: Raw String Question

2009-03-12 Thread Jim Garrison
Tim Chase wrote: >>> r"a\" SyntaxError: EOL while scanning string literal (, line 1) It seems the parser is interpreting the backslash as an escape character in a raw string if the backslash is the last character. Is this expected? Yep...as documented[1], "even a raw string cannot end in a

Getting final url when original url redirects

2009-03-12 Thread IanR
I'm processing RSS content from a # of given sources. Most of the time the url given by the RSS feed redirects to the real URL (I'm guessing they do this for tracking purposes) For example. This is a url that I get from and RSS feed, http://www.pheedcontent.com/click.phdo?i=d22e9bc7641aab8a05665

unbiased benchmark

2009-03-12 Thread Sam Ettessoc
Dear sir, I would like to share a benchmark I did. The computer used was a 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS 10.5.6 and a lots of software running (a typical developer workstation). Python benchmark: HAMBURGUESA:benchmark sam$ echo 1+1 > bench.py HAMBURGUESA:ben

Re: Raw String Question

2009-03-12 Thread Albert Hopkins
> > Yep...as documented[1], "even a raw string cannot end in an odd number > > of backslashes". > > So how do you explain this? > > >>> r'a\'b' > "a\\'b" That doesn't "end in an odd number of backslashes." Python is __repr__esenting a raw string as a "regular" string. Literally they

Re: What happened to NASA at Python? :(

2009-03-12 Thread Martin v. Löwis
>>> The Python home page no longer sports a promotion from NASA. What >>> happened, did we lose NASA. Where did they go? >> The python.org guys just decided it would be nice to have some >> different graphics. > > If they were so keen on new graphics, why did 2.6 revert > to the same icons that 2.

Re: unbiased benchmark

2009-03-12 Thread Grant Edwards
On 2009-03-12, Sam Ettessoc wrote: > Dear sir, [Rather odd "benchmark" troll elided.] > Sam Ettessoc > p.s. I have no affiliation with ruby or python devloppement team. A fact for which I'm sure both communities are grateful. -- Grant Edwards grante Yow! I feel

Re: unbiased benchmark

2009-03-12 Thread Daniel Fetchinson
> Dear sir, > > I would like to share a benchmark I did. The computer used was a > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS > 10.5.6 and a lots of software running (a typical developer > workstation). > > Python benchmark: > HAMBURGUESA:benchmark sam$ echo 1+1 > bench.py

finally successful in ods with python, just one help needed.

2009-03-12 Thread Krishnakant
Hello all specially John and Terry. I finally got my way around odfpy and could manage the spreadsheet to some extent. However I now have a small but unexpected problem. I would be very happy if some one could help me understand why is the text not getting centered in the spreadsheet I create.

Re: unbiased benchmark

2009-03-12 Thread Chris Rebert
On Thu, Mar 12, 2009 at 1:07 PM, Sam Ettessoc wrote: > I would like to share a benchmark I did. The computer used was a > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS > 10.5.6 and a lots of software running (a typical developer > workstation). > > Python benchmark: > HAMBUR

  1   2   >