Re: New syntax for blocks

2009-11-11 Thread r
On Nov 11, 1:25 am, Steven D'Aprano wrote: (snip) > Incorrect. > >>> True == None > False > >>> False == None > False Of course i meant True/False but my fingers were thinking None at the time. And besides if i don't make a mistake here or there what ever would you do with your time? ;-) Seven +

Re: New syntax for blocks

2009-11-11 Thread Steven D'Aprano
On Wed, 11 Nov 2009 00:08:58 -0800, r wrote: >> >    #variable "var" will never be created! >> That will cause no end of trouble. >> if range(N) as var: >>     do_something_with_var() >> if var: >>     print "Oops, this blows up if N <= 0" >> Conditional assignments are a terrible idea. > > Yea

Re: Choosing GUI Module for Python

2009-11-11 Thread Lorenzo Gatti
On Nov 10, 11:08 pm, Simon Hibbs wrote: > Since QT runs on Windows, > porting to the Windows version of QT shouldn't be hard. The PySide developers, who are better judges of their own project than you and me, consider a Windows port so hard (and time consuming) that they didn't even try; a secon

Re: how to create a pip package

2009-11-11 Thread Wolodja Wentland
On Tue, Nov 10, 2009 at 20:25 -0800, Phlip wrote: > On Nov 10, 3:11 pm, Wolodja Wentland > wrote: > > > The pip requirement file would contain the following line: > > -e git+git://example.com/repo.git#egg=rep > Let me ask it like this. What happens when a user types..? >sudo pip install re

Re: is None or == None ?

2009-11-11 Thread greg
Vincent Manis wrote: That's my point. I first heard about Moore's Law in 1974 from a talk given by Alan Kay. At about the same time, Gordon Bell had concluded, independently, that one needs extra address bit every 18 months Hmmm. At that rate, we'll use up the extra 32 bits in our 64 bit poin

python simply not scaleable enough for google?

2009-11-11 Thread Robert P. J. Day
http://groups.google.com/group/unladen-swallow/browse_thread/thread/4edbc406f544643e?pli=1 thoughts? rday -- Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Trainin

Re: New syntax for blocks

2009-11-11 Thread r
On Nov 11, 2:37 am, Steven D'Aprano wrote: > On Wed, 11 Nov 2009 00:08:58 -0800, r wrote: > > Yea it's called a NameError. Would it not also blow up in the current > > state of syntax usage? > > No. > > > if var: > >     print 'var' > > > Traceback (most recent call last): > >   File "", line 1,

Unexpected python exception

2009-11-11 Thread Richard Purdie
I've been having problems with an unexpected exception from python which I can summarise with the following testcase: def A(): import __builtin__ import os __builtin__.os = os def B(): os.stat("/") import os A() B() which results in: Traceback (most recent call last): Fi

Re: Unexpected python exception

2009-11-11 Thread Diez B. Roggisch
Richard Purdie schrieb: I've been having problems with an unexpected exception from python which I can summarise with the following testcase: def A(): import __builtin__ import os __builtin__.os = os def B(): os.stat("/") import os A() B() which results in: Traceback (mo

Knob label justification

2009-11-11 Thread Hugo Léveillé
By default, a boolean knob has the text label on the right. How can I make it on the left? thx -- http://mail.python.org/mailman/listinfo/python-list

Re: New syntax for blocks

2009-11-11 Thread Carl Banks
On Nov 10, 9:37 pm, Steven D'Aprano wrote: > On Tue, 10 Nov 2009 20:13:21 -0800, Carl Banks wrote: > > On Nov 10, 7:12 pm, Steven D'Aprano > > wrote: > >> On Tue, 10 Nov 2009 12:45:13 -0800, Bearophile wrote: > >> > r: > > >> >> i think the following syntax would be quite beneficial to replace >

Re: Unexpected python exception

2009-11-11 Thread Eduardo Lenz
Em Qua 11 Nov 2009, às 03:21:55, Diez B. Roggisch escreveu: > Richard Purdie schrieb: > > I've been having problems with an unexpected exception from python which > > I can summarise with the following testcase: > > > > def A(): > > import __builtin__ > > import os > > > > __builtin__.o

Re: Req. comments on "first version" ch 2 progr. intro (using Python 3.x in Windows)

2009-11-11 Thread Alf P. Steinbach
* Alf P. Steinbach: Chapter 2 "Basic Concepts" is about 0.666 completed and 30 pages so far. It's now Python 3.x, and reworked with lots of graphical examples and more explanatory text, plus limited in scope to Basic Concepts (which I previously just had as a first ch 2 section -- but there'

Re: New syntax for blocks

2009-11-11 Thread Carl Banks
On Nov 10, 9:44 pm, Terry Reedy wrote: > Carl Banks wrote: > > > r didn't actually give a good example.  Here is case where it's > > actually useful.  (Pretend the regexps are too complicated to be > > parsed with string method.) > > > if re.match(r'go\s+(north|south|east|west)',cmd) as m: > >    

Basic list/dictionary question

2009-11-11 Thread Daniel Jowett
Greetings, I'm trying to categorize items in a list, by copying them into a dictionary... A simple example with strings doesn't seem to work how I'd expect: >>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana'] >>> d = {} >>> d = d.fromkeys(basket, []) >>> d {'orange': [], 'pear':

Re: Knob label justification

2009-11-11 Thread Chris Rebert
On Wed, Nov 11, 2009 at 3:25 AM, Hugo Léveillé wrote: > By default, a boolean knob has the text label on the right. How can I make > it on the left? We're not mind readers. We'll need to know which GUI toolkit you're using. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mai

Re: Knob label justification

2009-11-11 Thread Hugo Leveille
Sorry, Im using the PythonPanel module of nuke. On 11/11/09 7:20 AM, "Chris Rebert" wrote: > On Wed, Nov 11, 2009 at 3:25 AM, Hugo Léveillé > wrote: >> By default, a boolean knob has the text label on the right. How can I make >> it on the left? > > We're not mind readers. We'll need to know

Re: Unexpected python exception

2009-11-11 Thread Chris Rebert
On Wed, Nov 11, 2009 at 8:49 AM, Eduardo Lenz wrote: > Em Qua 11 Nov 2009, às 03:21:55, Diez B. Roggisch escreveu: >> Richard Purdie schrieb: >> > I've been having problems with an unexpected exception from python which >> > I can summarise with the following testcase: >> > >> > def A(): >> >    

Re: My own accounting python euler problem

2009-11-11 Thread Steven D'Aprano
On Tue, 10 Nov 2009 14:59:13 -0800, John Machin wrote: > On Nov 8, 8:39 am, vsoler wrote: >> In the accounting department I am working for we are from time to time >> confronted to the following problem: > [snip] > >> My second question is: >> 2. this time there are also credit notes outstanding

Re: My own accounting python euler problem

2009-11-11 Thread John Machin
On Nov 8, 8:39 am, vsoler wrote: > In the accounting department I am working for we are from time to time > confronted to the following problem: > > A customer sends us a check for a given amount, but without specifying > what invoices it cancels. It is up to us to find out which ones the > paymen

Re: My own accounting python euler problem

2009-11-11 Thread Raymond Hettinger
[vsoler] > In the accounting department I am working for we are from time to time > confronted to the following problem: > > A customer sends us a check for a given amount, but without specifying > what invoices it cancels. It is up to us to find out which ones the > payment corresponds to. > > For

Re: Unexpected python exception

2009-11-11 Thread Richard Purdie
On Wed, 2009-11-11 at 12:21 +0100, Diez B. Roggisch wrote: > As the import-statement in a function/method-scope doesn't leak the > imported names into the module scope, python treats them as locals. > Which makes your code equivalent to > > > x = 1000 > > def foo(): > print x > x = 1

installing lxml ?

2009-11-11 Thread 7stud
I'm trying to install lxml, but I can't figure out the installation instructions. Here: http://codespeak.net/lxml/installation.html it says: 1) Get the easy_install tool. Ok, I went to the easy_install website, downloaded, and installed it. The last two lines of the output during installation

Re: Microsoft research on code quality

2009-11-11 Thread Mark Leander
> http://research.microsoft.com/en-us/news/features/nagappan-100609.aspx Thanks for the link! Hope he next takes on verifying that less code implies less bugs when other factors are constant, thus proving that Python is better than C and Java :-). Mark -- http://mail.python.org/mailman/listinfo/

Re: Basic list/dictionary question

2009-11-11 Thread Chris Rebert
On Wed, Nov 11, 2009 at 4:16 AM, Daniel Jowett wrote: > Greetings, > > I'm trying to categorize items in a list, by copying them into a > dictionary... > A simple example with strings doesn't seem to work how I'd expect: > basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']

Re: Authentication session with urllib2

2009-11-11 Thread Jon Clements
On 11 Nov, 07:02, Ken Seehart wrote: > I'm having some difficulty implementing a client that needs to maintain > an authenticated https: session. > > I'd like to avoid the approach of receiving a 401 and resubmit with > authentication, for two reasons: > > 1. I control the server, and it was easy

Re: New syntax for blocks

2009-11-11 Thread steve
Hi, On 11/11/2009 12:30 PM, r wrote: [...snip...] I think what has escaped everyone (including myself until my second post) is the fact that what really needs to happen is for variable *assignments* to return a boolean to any "statements" that evaluate the assignment -- like in an "if" or "elif"

Re: installing lxml ?

2009-11-11 Thread Chris Rebert
On Wed, Nov 11, 2009 at 4:49 AM, 7stud wrote: > I'm trying to install lxml, but I can't figure out the installation > instructions.  Here: > > http://codespeak.net/lxml/installation.html > > it says: > > 1) Get the easy_install tool. > My os is mac os x 10.4.11. I would recommend installing fink

Re: New syntax for blocks

2009-11-11 Thread samwyse
On Nov 10, 1:23 pm, r wrote: > Forgive me if i don't properly explain the problem but i think the > following syntax would be quite beneficial to replace some redundant > "if's" in python code. > > if something_that_returns_value() as value: >     #do something with value > > # Which can replace t

Re: Microsoft research on code quality

2009-11-11 Thread r
On Nov 7, 5:22 pm, Mensanator wrote: > Microsoft has more to answer for for the fuckups they install > deliberately than for the bugs that get in accidentally. Here!, Here! Very well put Mensanator! -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic list/dictionary question

2009-11-11 Thread Daniel Jowett
Thanks Chris, yes it's becoming clearer now. And defaultdict looks nice - unfortunately I'm stuck to python 2.4 as I'm using Plone. Thanks again, Daniel 2009/11/11 Chris Rebert > On Wed, Nov 11, 2009 at 4:16 AM, Daniel Jowett > wrote: > > Greetings, > > > > I'm trying to categorize items in

Re: Unexpected python exception

2009-11-11 Thread Chris Rebert
On Wed, Nov 11, 2009 at 4:37 AM, Richard Purdie wrote: > Is there a way to make the "global x" apply to all functions without > adding it to each one? Thankfully, no. > What I'm trying to do is to avoid having "import X" statements > everywhere by changing __builtin__. It seems my approach does

Re: Calendar Stuff

2009-11-11 Thread Victor Subervi
On Wed, Nov 11, 2009 at 1:12 AM, Simon Forman wrote: > On Tue, Nov 10, 2009 at 12:53 PM, Victor Subervi > wrote: > > Hi; > > I have the following code: > > > > import calendar, datetime > > > > def cal(): > > ... > > myCal = calendar.Calendar(calendar.SUNDAY) > > today = datetime.date.toda

Re: CGI vs mod_python

2009-11-11 Thread Victor Subervi
On Tue, Nov 10, 2009 at 6:12 PM, John Nagle wrote: > sstein...@gmail.com wrote: > >> >> On Nov 9, 2009, at 10:18 AM, Victor Subervi wrote: >> >> Yes, obviously. But if CGI is enabled, it should work anyway, should it >>> not? >>> >> >> Depends on what "CGI is enabled" means. >> >> Usually, web s

PyQt 2 Exe

2009-11-11 Thread baboucarr sanneh
Hi guys, I wan to make a gui app using pyqt so i have done some thing already now i want to save it as an exe file so that i can give it out to users who dont have pyqt installed (windows users)..Please help me out on this one..thnx Regards $LIM $...@dy

Re: Python C api: create a new object class

2009-11-11 Thread samwyse
On Nov 10, 1:09 pm, "lallous" wrote: > Hello > > I have 3 questions, hope someone can help: > > 1) > How can I create an instance class in Python, currently I do: > > class empty: >   pass > > Then anytime I want that class (which I treat like a dictionary): > > o = empty() > o.myattr = 1 > etc...

Re: installing lxml ?

2009-11-11 Thread Jussi Piitulainen
7stud writes: > I'm trying to install lxml, but I can't figure out the installation > instructions. Here: ... > My os is mac os x 10.4.11. But this: > > STATIC_DEPS=true easy_install lxml > > is not a valid command: > > $ sudo STATIC_DEPS=true easy_install lxml > Password: > sudo: STATIC_DEP

Re: Can't Write File

2009-11-11 Thread Victor Subervi
On Tue, Nov 10, 2009 at 4:33 PM, Dave Angel wrote: > Victor Subervi wrote: > >> Hi; >> I've determined the problem in a script is I can't open a file to write >> it: >> script = open(getpic, "w") # where getpic is already defined >> Here are the permissions: >> -rwxr-xr-x 1 root root 4649 Nov

Re: Basic list/dictionary question

2009-11-11 Thread Ralax
On Nov 11, 8:58 pm, Chris Rebert wrote: > On Wed, Nov 11, 2009 at 4:16 AM, Daniel Jowett > wrote: > > Greetings, > > > I'm trying to categorize items in a list, by copying them into a > > dictionary... > > A simple example with strings doesn't seem to work how I'd expect: > > basket = ['app

Re: Unexpected python exception

2009-11-11 Thread Ralax
On Nov 11, 6:59 pm, Richard Purdie wrote: > I've been having problems with an unexpected exception from python which > I can summarise with the following testcase: > > def A(): >     import __builtin__ >     import os > >     __builtin__.os = os > > def B(): >     os.stat("/") >     import os > >

Re: installing lxml ?

2009-11-11 Thread Diez B. Roggisch
Chris Rebert schrieb: On Wed, Nov 11, 2009 at 4:49 AM, 7stud wrote: I'm trying to install lxml, but I can't figure out the installation instructions. Here: http://codespeak.net/lxml/installation.html it says: 1) Get the easy_install tool. My os is mac os x 10.4.11. I would recommend in

Re: PyQt 2 Exe

2009-11-11 Thread Jorge
search the web, find the sites and follow the instructions. On Wed, Nov 11, 2009 at 2:11 PM, baboucarr sanneh wrote: > > How can i use it ? > > *$LIM $...@dy* > > > > > -- > Date: Wed, 11 Nov 2009 14:07:47 + > Subject: Re: PyQt 2 Exe > From: starglider...@gmail.co

Re: Unexpected python exception

2009-11-11 Thread Richard Purdie
On Wed, 2009-11-11 at 05:04 -0800, Chris Rebert wrote: > On Wed, Nov 11, 2009 at 4:37 AM, Richard Purdie wrote: > > > Is there a way to make the "global x" apply to all functions without > > adding it to each one? > > Thankfully, no. Hmm :(. > > What I'm trying to do is to avoid having "import

Re: installing lxml ?

2009-11-11 Thread Diez B. Roggisch
7stud schrieb: I'm trying to install lxml, but I can't figure out the installation instructions. Here: http://codespeak.net/lxml/installation.html it says: 1) Get the easy_install tool. Ok, I went to the easy_install website, downloaded, and installed it. The last two lines of the output dur

Re: PyQt 2 Exe

2009-11-11 Thread Benjamin Kaplan
On Wed, Nov 11, 2009 at 8:29 AM, baboucarr sanneh wrote: > Hi guys, > > I wan to make a gui app using pyqt so i have done some thing already now i > want to save it as an exe file so that i can give it out to users who dont > have pyqt installed  (windows users)..Please help me out on this one..th

Re: installing lxml ?

2009-11-11 Thread Benjamin Kaplan
On Wed, Nov 11, 2009 at 7:49 AM, 7stud wrote: > I'm trying to install lxml, but I can't figure out the installation > instructions.  Here: > > http://codespeak.net/lxml/installation.html > > it says: > > 1) Get the easy_install tool. > > Ok, I went to the easy_install website, downloaded, and inst

Re: installing lxml ?

2009-11-11 Thread 7stud
On Nov 11, 6:31 am, Jussi Piitulainen wrote: > 7stud writes: > > I'm trying to install lxml, but I can't figure out the installation > > instructions.  Here: > ... > > My os is mac os x 10.4.11.   But this: > > > STATIC_DEPS=true easy_install lxml > > > is not a valid command: > > > $ sudo STATIC_

Re: installing lxml ?

2009-11-11 Thread Benjamin Kaplan
On Wed, Nov 11, 2009 at 9:23 AM, Diez B. Roggisch wrote: > Chris Rebert schrieb: >> >> On Wed, Nov 11, 2009 at 4:49 AM, 7stud wrote: >>> >>> I'm trying to install lxml, but I can't figure out the installation >>> instructions.  Here: >>> >>> http://codespeak.net/lxml/installation.html >>> >>> it

Re: installing lxml ?

2009-11-11 Thread 7stud
On Nov 11, 7:37 am, "Diez B. Roggisch" wrote: > And third, > there are limits to what extend one can anticipate the ineptness of > others to read. The page you cite from starts with: > >    For special installation instructions regarding MS Windows and > MacOS-X, see below. > > And below you find

Re: Basic list/dictionary question

2009-11-11 Thread Mick Krippendorf
Ralax wrote: > On Nov 11, 8:58 pm, Chris Rebert wrote: >> In [2]: def foo(z, a=[]): >>...: a.append(z) >>...: return a >>...: >> >> In [3]: foo(1) >> Out[3]: [1] >> >> In [4]: foo(2) >> Out[4]: [1, 2] >> >> In [5]: foo(2) >> Out[5]: [1, 2, 2] >> >> In [6]: foo(3) >> Out[6]: [1,

Re: installing lxml ?

2009-11-11 Thread Stefan Behnel
7stud, 11.11.2009 16:12: > On Nov 11, 7:37 am, "Diez B. Roggisch" wrote: >> And third, >> there are limits to what extend one can anticipate the ineptness of >> others to read. The page you cite from starts with: >> >>For special installation instructions regarding MS Windows and >> MacOS-X, s

win32com IE interface PAMIE javascript click

2009-11-11 Thread elca
Hello, these day im making some script. i have encounter some problem with my script work. problem is i want to click emulate javascript on following site. http://news.naver.com/main/presscenter/category.nhn this site is news site. and everyday news content also changed, but javascript is not

Re: Most efficient way to "pre-grow" a list?

2009-11-11 Thread Francis Carr
Hmmm. I am trying some algorithms, and timeit reports that a list.extend variant is fastest... WTH?! Really this seems like it must be a "bug" in implementing the "[None]*x" idiom. As expected, appending one-at-a-time is slowest (by an order of magnitude): % python -m timeit -s "N=100" \

Re: Can't Write File

2009-11-11 Thread Rami Chowdhury
On Wed, 11 Nov 2009 06:00:44 -0800, Victor Subervi wrote: On Tue, Nov 10, 2009 at 4:33 PM, Dave Angel wrote: Victor Subervi wrote: Wrong? 2) you don't show the error traceback because there are none try: # It does this, because I've printed 'getpic1.py' etc.

Re: Can't Write File

2009-11-11 Thread Victor Subervi
On Wed, Nov 11, 2009 at 11:23 AM, Rami Chowdhury wrote: > On Wed, 11 Nov 2009 06:00:44 -0800, Victor Subervi < > victorsube...@gmail.com> wrote: > > On Tue, Nov 10, 2009 at 4:33 PM, Dave Angel wrote: >> >> Victor Subervi wrote: >>> >> > Wrong? >>> >>> 2) you don't show the error traceback >>>

Pause a script before termination

2009-11-11 Thread noydb
Hi All, I want to pause my script before it terminates, just so a user can have a moment to read some print statements I include at the end. How can this be accomplished? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Pause a script before termination

2009-11-11 Thread noydb
On Nov 11, 11:43 am, noydb wrote: > Hi All, > > I want to pause my script before it terminates, just so a user can > have a moment to read some print statements I include at the end.  How > can this be accomplished? > > Thanks! Never mind, duh, found my answer now import time time.sleep(10) #10

Re: Can't Write File

2009-11-11 Thread Rami Chowdhury
On Wed, 11 Nov 2009 08:42:27 -0800, Victor Subervi wrote: On Wed, Nov 11, 2009 at 11:23 AM, Rami Chowdhury wrote: On Wed, 11 Nov 2009 06:00:44 -0800, Victor Subervi < victorsube...@gmail.com> wrote: On Tue, Nov 10, 2009 at 4:33 PM, Dave Angel wrote: Victor Subervi wrote: Wrong?

Re: Can't Write File

2009-11-11 Thread Carsten Haese
Victor Subervi wrote: > Here's > a bigger code snippet with the entire try clause: > > if 14 < x < 20: # This just shows that it's a pic, not some > other type of data > y += 1 > w += 1 > try: # It does this, because I've printed 'getpic1.py' etc. >

Re: Pause a script before termination

2009-11-11 Thread Philip Semanchuk
On Nov 11, 2009, at 11:47 AM, noydb wrote: On Nov 11, 11:43 am, noydb wrote: Hi All, I want to pause my script before it terminates, just so a user can have a moment to read some print statements I include at the end. How can this be accomplished? Thanks! Never mind, duh, found my ans

Re: Pause a script before termination

2009-11-11 Thread Gary Herron
noydb wrote: Hi All, I want to pause my script before it terminates, just so a user can have a moment to read some print statements I include at the end. How can this be accomplished? Thanks! If your IO is to/from a command line window, try this: raw_input('Hit ENTER to exit: ') Gary Her

RE: Pause a script before termination

2009-11-11 Thread baboucarr sanneh
$LIM $...@dy > From: jenn.du...@gmail.com > Subject: Re: Pause a script before termination > Date: Wed, 11 Nov 2009 08:47:05 -0800 > To: python-list@python.org > > On Nov 11, 11:43 am, noydb wrote: > > Hi All, > > > > I want to pause my script before it terminates, just so a user can > > h

Re: Authentication session with urllib2

2009-11-11 Thread Ken Seehart
Jon Clements wrote: On 11 Nov, 07:02, Ken Seehart wrote: I'm having some difficulty implementing a client that needs to maintain an authenticated https: session. I'd like to avoid the approach of receiving a 401 and resubmit with authentication, for two reasons: 1. I control the

How to specify Python version in script?

2009-11-11 Thread kj
I have a script that must be run with Python 2.6.x. If one tries to run it with, say, 2.5.x, *eventually* it runs into problems and crashes. (The failure is quicker if one attempts to run it with Python 3.x.) Is there some way to specify at the very beginning of the script the acceptable ran

ask a question about the module

2009-11-11 Thread leo zhao
when I run a program, it list the hint: Could not import module "Gnuplot" - it is not installed on your system. You need to install the Gnuplot.py package. \easyviz\gnuplot_.py(41) : Traceback (most recent call last): File "E:\study\python\commodity modle 10.23.py", line 3, in import mult

Re: Can't Write File

2009-11-11 Thread Victor Subervi
On Wed, Nov 11, 2009 at 11:58 AM, Carsten Haese wrote: > Victor Subervi wrote: > > Here's > > a bigger code snippet with the entire try clause: > > > > if 14 < x < 20: # This just shows that it's a pic, not some > > other type of data > > y += 1 > > w += 1 > >

Re: How to specify Python version in script?

2009-11-11 Thread David Robinow
On Wed, Nov 11, 2009 at 12:16 PM, kj wrote: > > > > > I have a script that must be run with Python 2.6.x.  If one tries > to run it with, say, 2.5.x, *eventually* it runs into problems and > crashes.  (The failure is quicker if one attempts to run it with > Python 3.x.) > > Is there some way to sp

Re: Can't Write File

2009-11-11 Thread Carsten Haese
Victor Subervi wrote: > I will do that after I fix the problem "Doing that" is the fix. > No, this doesn't fix the problem! How do you know? You obviously haven't tried it, since you say you have yet to do it. -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailma

Re: How to specify Python version in script?

2009-11-11 Thread Benjamin Kaplan
On Wed, Nov 11, 2009 at 12:16 PM, kj wrote: > > > > > I have a script that must be run with Python 2.6.x.  If one tries > to run it with, say, 2.5.x, *eventually* it runs into problems and > crashes.  (The failure is quicker if one attempts to run it with > Python 3.x.) > > Is there some way to sp

Re: Can't Write File

2009-11-11 Thread Benjamin Kaplan
On Wed, Nov 11, 2009 at 11:42 AM, Victor Subervi wrote: > On Wed, Nov 11, 2009 at 11:23 AM, Rami Chowdhury > wrote: >> >> On Wed, 11 Nov 2009 06:00:44 -0800, Victor Subervi >> wrote: >> >>> On Tue, Nov 10, 2009 at 4:33 PM, Dave Angel wrote: >>> Victor Subervi wrote: >> Wrong? 2)

Re: How to specify Python version in script?

2009-11-11 Thread Javier Collado
Hello, If you are working on linux, you can change the shebang line from: #!/usr/bin/python to: #!/usr/bin/python2.6 Best regards, Javier P.S. If you just want to avoid python 3 while running the latest python 2.x version, this should also work: #!/usr/bin/python2 2009/11/11 Benjamin Kapla

Re: How to specify Python version in script?

2009-11-11 Thread Benjamin Kaplan
On Wed, Nov 11, 2009 at 1:28 PM, Javier Collado wrote: > Hello, > > If you are working on linux, you can change the shebang line from: > #!/usr/bin/python > > to: > #!/usr/bin/python2.6 > > Best regards, >    Javier > > P.S. If you just want to avoid python 3 while running the latest > python 2.x

Re: New syntax for blocks

2009-11-11 Thread Robert Latest
r wrote: > Just thinking out loud here...what if variable assignments could > return a value... hmmm? Not to them selfs of course but to a caller, > like an if statement... > > if a=openfile: > # do something with a That's like in C. I sometimes miss it in Python. robert -- http://mail.python.

Re: Can't Write File

2009-11-11 Thread Victor Subervi
On Wed, Nov 11, 2009 at 1:20 PM, Benjamin Kaplan wrote: > On Wed, Nov 11, 2009 at 11:42 AM, Victor Subervi > wrote: > > On Wed, Nov 11, 2009 at 11:23 AM, Rami Chowdhury < > rami.chowdh...@gmail.com> > > wrote: > >> > >> On Wed, 11 Nov 2009 06:00:44 -0800, Victor Subervi > >> wrote: > >> > >>> On

Re: New syntax for blocks

2009-11-11 Thread Terry Reedy
Steven D'Aprano wrote: Why is the third example, with an if... test, so special that it needs special syntax to make it a two-liner? ...because Beautiful is better than ugly. I can quote the Zen too: Special cases aren't special enough to break the rules. You haven't demonstrated that your

Re: installing lxml ?

2009-11-11 Thread srid
Much of these non-trivial build steps are abstracted in the ActiveState build repository. 1. Download ActivePython: http://www.activestate.com/activepython/ 2. Run "pypm install lxml" (on Mac, Linux or Windows) $ pypm install lxml Ready to perform these actions: The following packages will be ins

Re: Can't Write File

2009-11-11 Thread Victor Subervi
Never mind. It appears my old original file from a couple of years ago prints out the image nicely. Thanks all! V On Wed, Nov 11, 2009 at 2:26 PM, Victor Subervi wrote: > On Wed, Nov 11, 2009 at 1:20 PM, Benjamin Kaplan > wrote: > >> On Wed, Nov 11, 2009 at 11:42 AM, Victor Subervi >> wrote: >>

Re: installing lxml ?

2009-11-11 Thread srid
On Nov 11, 6:54 am, 7stud wrote: > > Unfortunately, easy_install was not able to installlxml!  Here is the > output: > > --- > $ sudo STATIC_DEPS=true /Library/Frameworks/Python.framework/Versions/ > 2.6/bin/easy_installlxml > Password: > sudo: STATIC_DEPS=true: command not found > $ STATIC_DEPS=t

Re: Can't Write File

2009-11-11 Thread Rami Chowdhury
Now, the problem is that it doesn't print the picture. It prints only the url. Please try: http://angrynates.com/stcroixresort/cart/getpic.py?w=1&i=1 Now, if I go into mysql and the correct database and enter: select pic1 from products where ID=1; it starts printing out all sorts of crap (indicati

Re: Can't Write File

2009-11-11 Thread Victor Subervi
On Wed, Nov 11, 2009 at 2:46 PM, Rami Chowdhury wrote: > Now, the problem is that it doesn't print the picture. It prints only the >> url. Please try: >> http://angrynates.com/stcroixresort/cart/getpic.py?w=1&i=1 >> Now, if I go into mysql and the correct database and enter: >> select pic1 from pr

Re: Pause a script before termination

2009-11-11 Thread David
Il Wed, 11 Nov 2009 08:43:29 -0800 (PST), noydb ha scritto: > Hi All, > > I want to pause my script before it terminates, just so a user can > have a moment to read some print statements I include at the end. How > can this be accomplished? http://stackoverflow.com/questions/510357/python-read-

Re: python simply not scaleable enough for google?

2009-11-11 Thread Terry Reedy
Robert P. J. Day wrote: http://groups.google.com/group/unladen-swallow/browse_thread/thread/4edbc406f544643e?pli=1 thoughts? Program_cost = human_writing&maintance_cost + running_cost*number_of_runs Nothing new here. The builtin types and many modules are written in C to reduce running cos

Re: How to specify Python version in script?

2009-11-11 Thread kj
In Benjamin Kaplan writes: >On Wed, Nov 11, 2009 at 12:16 PM, kj wrote: >> >> >> >> >> I have a script that must be run with Python 2.6.x. =A0If one tries >> to run it with, say, 2.5.x, *eventually* it runs into problems and >> crashes. =A0(The failure is quicker if one attempts to run it with

Re: CGI vs mod_python

2009-11-11 Thread Dave Angel
Victor Subervi wrote: The problem was not CGI. It turned out to be line-endings being mangled by Windoze and __invisible __ in my unix editor. Lovely. Thanks anyway, V That's twice you've blamed Windows for the line-ending problem. Windows didn't create those crlf endings, your text edit

Re: installing lxml ?

2009-11-11 Thread Terry Reedy
7stud wrote: On Nov 11, 7:37 am, "Diez B. Roggisch" wrote: And third, there are limits to what extend one can anticipate the ineptness of Calling you inept was unnecessary, but others to read. The page you cite from starts with: You wrote " I'm trying to install lxml, but I can't figu

Re: Threaded import hang in cPickle.dumps

2009-11-11 Thread Zac Burns
On Tue, Nov 10, 2009 at 2:27 PM, Benjamin Peterson wrote: > Zac Burns gmail.com> writes: >> What can I do about this? > > Not run it in a thread. > > > > -- > http://mail.python.org/mailman/listinfo/python-list > Isn't requesting that pickle not be used in a thread a bit of a tall order? Just th

Re: Securing a multiprocessing.BaseManager connection via SSL

2009-11-11 Thread Aahz
In article , Jonas wrote: > >how can I secure the communication between two BaseManager objects? >Regarding the socket/SSL documentation I just need to secure the socket >by SSL. How can i get the socket object within the multiprocessing >module? You'll need to create subclasses of the objects i

Re: How can a module know the module that imported it?

2009-11-11 Thread Aahz
In article , kj wrote: > >The subject line says it all. You are probably trying to remove a screw with a hammer -- why don't you tell us what you really want to do and we'll come up with a Pythonic solution? -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ [on o

Re: Threaded import hang in cPickle.dumps

2009-11-11 Thread Antoine Pitrou
Le Tue, 10 Nov 2009 10:50:33 -0800, Zac Burns a écrit : > > cPickle.dumps has an import which is causing my application to hang. > (figured out by overriding builtin.__import__ with a print and seeing > that this is the last line of code being run. I'm running cPickle.dumps > in a thread, which le

Re: How can a module know the module that imported it?

2009-11-11 Thread kj
In a...@pythoncraft.com (Aahz) writes: >In article , kj wrote: >> >>The subject line says it all. >You are probably trying to remove a screw with a hammer Worse: I'm trying to write Perl using Python! >-- why don't you >tell us what you really want to do and we'll come up with a Pythonic >so

Re: How can a module know the module that imported it?

2009-11-11 Thread Ethan Furman
Aahz wrote: In article , kj wrote: The subject line says it all. You are probably trying to remove a screw with a hammer -- why don't you tell us what you really want to do and we'll come up with a Pythonic solution? Well, I don't know what kj is trying to do, but my project is another

Re: Threaded import hang in cPickle.dumps

2009-11-11 Thread Christian Heimes
Zac Burns wrote: > Using python 2.6 > > cPickle.dumps has an import which is causing my application to hang. > (figured out by overriding builtin.__import__ with a print and seeing > that this is the last line of code being run. I'm running > cPickle.dumps in a thread, which leads me to believe th

Re: python simply not scaleable enough for google?

2009-11-11 Thread Alain Ketterlin
Terry Reedy writes: > I can imagine a day when code compiled from Python is routinely > time-competitive with hand-written C. Have a look at http://code.google.com/p/unladen-swallow/downloads/detail?name=Unladen_Swallow_PyCon.pdf&can=2&q= Slide 6 is impressive. The bottom of slide/page 22 expla

Re: How can a module know the module that imported it?

2009-11-11 Thread Diez B. Roggisch
Because the problem that gave rise to this question is insignificant. I would want to know the answer in any case. *Can* it be done in Python at all? No. OK, if you must know: With Perl one can set a module-global variable before the module is loaded. This provides a very handy backdoor du

Re: How can a module know the module that imported it?

2009-11-11 Thread Christian Heimes
kj wrote: > Because the problem that gave rise to this question is insignificant. > I would want to know the answer in any case. *Can* it be done in > Python at all? > > OK, if you must know: > > With Perl one can set a module-global variable before the module > is loaded. This provides a very

Re: How can a module know the module that imported it?

2009-11-11 Thread Steven D'Aprano
On Wed, 11 Nov 2009 21:55:58 +, kj wrote: > With Perl one can set a module-global variable before the module is > loaded. This provides a very handy backdoor during testing. E.g. Any time somebody justifies a features as "a very handy backdoor", a billion voices cry out and then are suddenl

Re: Can't Write File

2009-11-11 Thread Rhodri James
On Wed, 11 Nov 2009 14:00:44 -, Victor Subervi wrote: 6) you don't indicate which user is executing this script (only root can write to it) Help me on this. All scripts are owned by root. Is it not root that is executing the script? Not unless your server setup is very, very stupid.

Re: how to create a pip package

2009-11-11 Thread srid
On Nov 10, 8:25 pm, Phlip wrote: > On Nov 10, 3:11 pm, Wolodja Wentland > wrote: > > > The pip requirement file would contain the following line: > > > -e git+git://example.com/repo.git#egg=rep > > > I hope this answers your questions :-D > > Let me ask it like this. What happens when a user type

Re: pythonw.exe under Windows-7 (Won't run for one admin user)

2009-11-11 Thread Rhodri James
On Wed, 11 Nov 2009 04:51:38 -, SD_V897 wrote: Rhodri James wrote: On Tue, 10 Nov 2009 15:39:46 -, SD_V897 wrote: No, I'm asking you -- or rather your admin user -- to invoke the program that is giving you grief from the command line, i.e. "python myscript.py", and tell me wha

Re: New syntax for blocks

2009-11-11 Thread Steven D'Aprano
On Wed, 11 Nov 2009 04:00:09 -0800, Carl Banks wrote: >> as has been posted before and again in a slightly different form in >> Steve's post. > > I'm well aware of it, but I didn't think the proposal deserved to be > called stupid when it was a reasonable solution to a real need, even > though a

  1   2   >