Re: value of pi and 22/7

2011-03-18 Thread peter
On Mar 17, 5:22 pm, Kee Nethery k...@kagi.com wrote:
 My favorite approximation is: 355/113  (visualize 113355 split into two 113 
 355 and then do the division). The first 6 decimal places are the same.

 3.141592920353982 = 355/113
 vs
 3.1415926535897931

 Kee Nethery

Or (more for fun than any practical application) try (2143/22)^(1/4) =
3.14159265268.

Other approximations I have seen are root(10) and 3.142.  This last
was especially popular at school, which for me was sufficiently long
ago to have used four figure log tables.

The Old Testament (1 Kings 7,23) says ... And he made a molten sea,
ten cubits from the one brim to the other: it was round all about, and
his height was five cubits: and a line of thirty cubits did compass it
round about. .  So pi=3.  End Of.








-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-18 Thread Duncan Booth
Terry Reedy tjre...@udel.edu wrote:

 On 3/17/2011 10:00 PM, Terry Reedy wrote:
 On 3/17/2011 8:24 PM, J Peyret wrote:
 This gives a particularly nasty abend in Windows - Python.exe has
 stopped working, rather than a regular exception stack error. I've
 fixed it, after I figured out the cause, which took a while, but 
maybe
 someone will benefit from this.

 Python 2.6.5 on Windows 7.

 class Foo(object):
 pass

 Foo.__repr__ = Foo.__str__ # this will cause an abend.

 2.7.1 and 3.2.0 on winxp, no problem, interactive intepreter or IDLE
 shell. Upgrade?
 
 To be clear, the above, with added indent, but with extra fluff 
(fixes) 
 removed, is exactly what I ran. If you got error with anything else, 
 please say so. Described behavior for legal code is a bug. However, 
 unless a security issue, it would not be fixed for 2.6.
 
On Windows, I can replicate this with Python 2.7, Python 3.1.2, and 
Python 3.2. Here's the exact script (I had to change the print to be 
compatible with Python 3.2):

 bug.py --
class Foo(object):
pass
#def __str__(self):  #if you have this defined, no abend
#return a Foo

Foo.__repr__ = Foo.__str__   # this will cause an abend.
#Foo.__str__ = Foo.__repr__  #do this instead, no abend

foo = Foo()
print(str(foo))

--

for Python 3.2 the command:
C:\Tempc:\python32\python bug.py

generates a popup:

python.exe - Application Error
The exception unknown software exception (0xcfd) occurred in the 
application at location 0x1e08a325.

Click on OK to terminate the program
Click on CANCEL to debug the program

So it looks to me to be a current bug.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fitting polynomial curve

2011-03-18 Thread eryksun ()
On 3/17/2011 1:42 AM, Astan Chee wrote:

 I have 2 points in 3D space and a bunch of points in-between them. I'm
 trying to fit a polynomial curve on it. Currently I'm looking through
 numpy but I don't think the function exists to fit a function like this:
 y = ax**4 + bx**3 + cx**2 + dx + e

You can use np.polyfit, which uses np.linalg.lstsq. 

For a degree M-1 polynomial and K samples such that K  M, this is an 
over-determined least squares problem:

t = [t1, t2, ..., tk]   # K sample times
Y.shape == (K, N)   # data samples Y in R_N

# design matrix X
# you don't have to calculate this since polyfit does it
# for you internally with vander(t, M)
X = [[x**m for m in range(M-1,-1,-1)] for x in t]
X.shape == (K, M)

# unknown coefficient matrix B
B.shape == (M, N)  

Y =~ dot(X, B) 

Use polyfit to form the least squares solution. For example, a 4th order fit:

B = np.polyfit(t, Y, 4)

# or for more information
B, r, rankX, sX, rcond = np.polyfit(t, Y, 4, full=True)

where r is the vector of residuals; rankX and sX are the rank and singular 
values of the Van der Monde matrix; and rcond was used to threshold the 
singular values.

Interpolation: 

t2 = np.linspace(t[0], t[-1], len(t)*1000)

Y2 = np.dot(np.vander(t2, M), B)
or 
Y2 = np.polyval(B, t2[:, newaxis])

polyval uses Horner's method, which calculates the following:

t = t2[:, newaxis]
y = zeros_like(t)

for i in range(len(B)):
y = y * t + B[i]
return y

y is initially a length len(t) column vector of zeros and B[0] is a length N 
row vector, so the first iteration just tiles B[0] in a len(t) by N matrix. 
Otherwise it's a normal Horner evaluation.

Other than minimizing the residuals, you can examine the fit visually with a 
simple matplotlib plot:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot(*Y2.T)
ax.plot(*Y.T, marker='.', markerfacecolor='r')

Or you could create three 2D plots of (t2, Y2[:,i]) and (t, Y[:,i]).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-18 Thread eryksun ()
On Thursday, March 17, 2011 8:24:36 PM UTC-4, J Peyret wrote:

 I suspect that object.__str__ is really object.__repr__ by default, as
 they both print out the same string, so that this doesn't make any
 sense.

They're not the same object, and they don't have all of the same methods. 

In [1]: object.__repr__ is object.__str__
Out[1]: False

In [2]: object.__repr__.__name__
Out[2]: '__repr__'

In [3]: object.__str__.__name__
Out[3]: '__str__'

In [4]: object.__repr__.__hash__()
Out[4]: 28910896

In [5]: object.__str__.__hash__()
Out[5]: 28910976

In [6]: object.__repr__.__call__(100)
Out[6]: 'int object at 0x01BE5234'

In [7]: object.__str__.__call__(100)
Out[7]: '100'
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiprocessing.Process Daemonic Behavior

2011-03-18 Thread Anssi Saari
John L. Stephens lists.jksteph...@gmail.com writes:

 As the parent process terminates 'normally' (either through normal
 termination or SIGINT termination), mulitprocessing steps in and
 performs child process cleanup via the x.terminate() method.  If the
 parent terminates any other way, multiprocessing doesn't have the
 opportunity to cleanup.

Unless you handle the signal explicitly? Since SIGINT maps to
KeyboardInterrupt automatically, you basically handle SIGINT but
nothing else. A rude hack to your example with a handler for SIGTERM
which just raises KeyboardInterrupt resulted in the children getting
the SIGTERM 10 seconds afterwards. Which is after the sleep(10) call
finishes in your script.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Neil Cerutti
On 2011-03-18, peter peter.mos...@talk21.com wrote:
 The Old Testament (1 Kings 7,23) says ... And he made a molten
 sea, ten cubits from the one brim to the other: it was round
 all about, and his height was five cubits: and a line of thirty
 cubits did compass it round about. .  So pi=3.  End Of.

RIIght.  What's a cubit?

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Stefan Behnel

Neil Cerutti, 18.03.2011 13:17:

On 2011-03-18, peterpeter.mos...@talk21.com  wrote:

The Old Testament (1 Kings 7,23) says ... And he made a molten
sea, ten cubits from the one brim to the other: it was round
all about, and his height was five cubits: and a line of thirty
cubits did compass it round about. .  So pi=3.  End Of.


RIIght.  What's a cubit?


http://en.wikipedia.org/wiki/Cubit

I think that particular author of that particular part of the bible just 
used it to make the text appear older than it was at the time.


Stefan

--
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Neil Cerutti
On 2011-03-18, Stefan Behnel stefan...@behnel.de wrote:
 Neil Cerutti, 18.03.2011 13:17:
 On 2011-03-18, peterpeter.mos...@talk21.com  wrote:
 The Old Testament (1 Kings 7,23) says ... And he made a molten
 sea, ten cubits from the one brim to the other: it was round
 all about, and his height was five cubits: and a line of thirty
 cubits did compass it round about. .  So pi=3.  End Of.

 RIIght.  What's a cubit?

 http://en.wikipedia.org/wiki/Cubit

 I think that particular author of that particular part of the
 bible just used it to make the text appear older than it was at
 the time.

http://www.youtube.com/watch?v=n0KHt8xrQkk

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Aage Andersen

peter
Kee Nethery  My favorite approximation is: 355/113 (visualize 113355 split 
into two 113 355 and then do the division). The first 6 decimal places are 
the same.

 3.141592920353982 = 355/113
 vs
 3.1415926535897931

 Kee Nethery

Or (more for fun than any practical application) try (2143/22)^(1/4) =
3.14159265268.

Other approximations I have seen are root(10) and 3.142.  This last
was especially popular at school, which for me was sufficiently long
ago to have used four figure log tables.

The Old Testament (1 Kings 7,23) says ... And he made a molten sea,
ten cubits from the one brim to the other: it was round all about, and
his height was five cubits: and a line of thirty cubits did compass it
round about. .  So pi=3.  End Of.
---

3 is the best integer approximation to pi. So the bibel is right.

Aage












-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Sherm Pendley
Stefan Behnel stefan...@behnel.de writes:

 Neil Cerutti, 18.03.2011 13:17:
 On 2011-03-18, peterpeter.mos...@talk21.com  wrote:
 The Old Testament (1 Kings 7,23) says ... And he made a molten
 sea, ten cubits from the one brim to the other: it was round
 all about, and his height was five cubits: and a line of thirty
 cubits did compass it round about. .  So pi=3.  End Of.

 RIIght.  What's a cubit?

 http://en.wikipedia.org/wiki/Cubit

 I think that particular author of that particular part of the bible
 just used it to make the text appear older than it was at the time.

Sigh. Doesn't *anyone* know Cosby any more? Kids today, no appreciation
for the classics. :-(

sherm--

-- 
Sherm Pendley
   http://camelbones.sourceforge.net
Cocoa Developer
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Westley Martínez
On Fri, 2011-03-18 at 02:10 -0700, peter wrote:
 On Mar 17, 5:22 pm, Kee Nethery k...@kagi.com wrote:
  My favorite approximation is: 355/113  (visualize 113355 split into two 113 
  355 and then do the division). The first 6 decimal places are the same.
 
  3.141592920353982 = 355/113
  vs
  3.1415926535897931
 
  Kee Nethery
 
 Or (more for fun than any practical application) try (2143/22)^(1/4) =
 3.14159265268.
 
 Other approximations I have seen are root(10) and 3.142.  This last
 was especially popular at school, which for me was sufficiently long
 ago to have used four figure log tables.
 
 The Old Testament (1 Kings 7,23) says ... And he made a molten sea,
 ten cubits from the one brim to the other: it was round all about, and
 his height was five cubits: and a line of thirty cubits did compass it
 round about. .  So pi=3.  End Of.
 
 
 
 
 
 
 
 
The Bible uses integers due to memory constraints.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Stefan Behnel

Sherm Pendley, 18.03.2011 14:46:

Stefan Behnel writes:


Neil Cerutti, 18.03.2011 13:17:

On 2011-03-18, peterpeter.mos...@talk21.com   wrote:

The Old Testament (1 Kings 7,23) says ... And he made a molten
sea, ten cubits from the one brim to the other: it was round
all about, and his height was five cubits: and a line of thirty
cubits did compass it round about. .  So pi=3.  End Of.


RIIght.  What's a cubit?


http://en.wikipedia.org/wiki/Cubit

I think that particular author of that particular part of the bible
just used it to make the text appear older than it was at the time.


Sigh. Doesn't *anyone* know Cosby any more? Kids today, no appreciation
for the classics. :-(


And what about Heinz Erhardt? *That's* a classic.

Stefan

--
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Grant Edwards
On 2011-03-18, peter peter.mos...@talk21.com wrote:

 The Old Testament (1 Kings 7,23) says ... And he made a molten sea,
 ten cubits from the one brim to the other: it was round all about, and
 his height was five cubits: and a line of thirty cubits did compass it
 round about. .  So pi=3.  End Of.

There's nothing wrong with that value.  The measurements were given
with one significant digit, so the ratio of the two measurements
should only have one significant digit.

-- 
Grant Edwards   grant.b.edwardsYow! It's some people
  at   inside the wall!  This is
  gmail.combetter than mopping!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Kee Nethery

On Mar 18, 2011, at 5:17 AM, Neil Cerutti wrote:

 On 2011-03-18, peter peter.mos...@talk21.com wrote:
 The Old Testament (1 Kings 7,23) says ... And he made a molten
 sea, ten cubits from the one brim to the other: it was round
 all about, and his height was five cubits: and a line of thirty
 cubits did compass it round about. .  So pi=3.  End Of.
 
 RIIght.  What's a cubit?

I use cubits all the time. The distance from my elbow to my finger tips equals 
one cubit. When you don't have a proper measuring tape, it can be pretty 
accurate for comparing two measurements.

Kee Nethery


-- 
http://mail.python.org/mailman/listinfo/python-list


Bounds checking

2011-03-18 Thread Martin De Kauwe
Hi,

if one has a set of values which should never step outside certain
bounds (for example if the values were negative then they wouldn't be
physically meaningful) is there a nice way to bounds check? I
potentially have 10 or so values I would like to check at the end of
each iteration. However as the loop is over many years I figured I
probably want to be as optimal as possible with my check. Any
thoughts?

e.g. this is my solution

# module contain data
# e.g. print state.something might produce 4.0
import state as state

def main():
for i in xrange(num_days):
# do stuff

# bounds check at end of iteration
bounds_check(state)


def bounds_check(state):
 check state values are  0 
for attr in dir(state):
if not attr.startswith('__') and getattr(state, attr)  0.0:
print Error state values  0: %s % (attr)
sys.exit()

if __name__ == __main__:
sys.exit(main())

thanks

Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread John Gordon
In 8uh0rcfe1...@mid.individual.net Neil Cerutti ne...@norwich.edu writes:

 RIIght.  What's a cubit?

How long can you tread water?

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Katie T
What sort of checks are you making ?  - in general greater than/less than
tend to be fairly optimal, although you might be able to do a faster is
negative test

Katie

On Fri, Mar 18, 2011 at 2:24 PM, Martin De Kauwe mdeka...@gmail.com wrote:

 Hi,

 if one has a set of values which should never step outside certain
 bounds (for example if the values were negative then they wouldn't be
 physically meaningful) is there a nice way to bounds check? I
 potentially have 10 or so values I would like to check at the end of
 each iteration. However as the loop is over many years I figured I
 probably want to be as optimal as possible with my check. Any
 thoughts?

 e.g. this is my solution

 # module contain data
 # e.g. print state.something might produce 4.0
 import state as state

 def main():
for i in xrange(num_days):
# do stuff

# bounds check at end of iteration
bounds_check(state)


 def bounds_check(state):
 check state values are  0 
for attr in dir(state):
if not attr.startswith('__') and getattr(state, attr)  0.0:
print Error state values  0: %s % (attr)
sys.exit()

 if __name__ == __main__:
sys.exit(main())

 thanks

 Martin
 --
 http://mail.python.org/mailman/listinfo/python-list




-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Jean-Michel Pichavant

Martin De Kauwe wrote:

Hi,

if one has a set of values which should never step outside certain
bounds (for example if the values were negative then they wouldn't be
physically meaningful) is there a nice way to bounds check? I
potentially have 10 or so values I would like to check at the end of
each iteration. However as the loop is over many years I figured I
probably want to be as optimal as possible with my check. Any
thoughts?

e.g. this is my solution

# module contain data
# e.g. print state.something might produce 4.0
import state as state

def main():
for i in xrange(num_days):
# do stuff

# bounds check at end of iteration
bounds_check(state)


def bounds_check(state):
 check state values are  0 
for attr in dir(state):
if not attr.startswith('__') and getattr(state, attr)  0.0:
print Error state values  0: %s % (attr)
sys.exit()

if __name__ == __main__:
sys.exit(main())

thanks

Martin
  
Don't check for bounds, fix any bug in the code that would set your 
values out of bounds and use asserts while debugging.


Otherwise if you really need dynamic checks, it will cost you cpu, for 
sure. Howeverver you could for instance override the __setatttr__ of 
state object, and call the attribute's associated function.


class State(object):
   funcTable = {
  'foo': lambda x: x = 0.0
   }
  
   def __init__(self):

  self.foo = 0

   def __setattr__(self, attribute, value):
  if not self.funcTable.get(attribute, lambda x: True)(value):
  sys.exit('error out of bound')
  return object.__setattr(self, attribute, value)


Untested, however it's just an idea. I'm not even sure that would be 
less cpu consuming :D
That way only attributes in functable execute a (cpu consuming ?) test 
function, all other attributes will execute 'lambda x: True'.


The check occurs everytime you set an attribute however.

JM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Mel
Jean-Michel Pichavant wrote:
 Martin De Kauwe wrote:

 Don't check for bounds, fix any bug in the code that would set your
 values out of bounds and use asserts while debugging.
[ ... ]
 def __setattr__(self, attribute, value):
if not self.funcTable.get(attribute, lambda x: True)(value):
sys.exit('error out of bound')
return object.__setattr(self, attribute, value)

Offhand, my only quibble is that sys.exit is not helpful for debugging.  
Much better to raise an error:

if not self.funcTable.get(attribute, lambda x: True)(value):
raise ValueError ('error out of bound')

or define a subclass of ValueError just for this purpose.  On error, the 
program will stop just as dead, but you'll get a trace.

Mel.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2011-03-18 Thread Adam Tauno Williams
On Fri, 2011-03-18 at 14:16 +, Grant Edwards wrote:
 On 2011-03-18, peter peter.mos...@talk21.com wrote:
  The Old Testament (1 Kings 7,23) says ... And he made a molten sea,
  ten cubits from the one brim to the other: it was round all about, and
  his height was five cubits: and a line of thirty cubits did compass it
  round about. .  So pi=3.  End Of.
 There's nothing wrong with that value.  The measurements were given
 with one significant digit, so the ratio of the two measurements
 should only have one significant digit.

I've worked in landscaping and [low-scale] agriculture - pi as 3 is used
all the time.  It is easy to compute in your head and close enough.  


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: email library

2011-03-18 Thread Ethan Furman

peterob wrote:

Im completely confinvalided from email library. When you parse email from
file it creates object Message.

f = open(emailFile, 'r')
msg = email.message_from_file(f)
f.close()


How can I access RAW header of email represented by object msg? I dont
wanna access each header field by hand.

Im doing another parsing, searching for attachments and so on, with
email, but i need write raw data of email too. Do I have to allocate
another memory for that emailFile? (by mmap or f=open(rawemail).


For the ultimate in raw, open the email file and parse it manually.

Your other option is use msg.walk() and msg.items() and walk through the 
returned (header, value) pairs.


8-
-- import email
-- msg = email.message_from_file(open(r'c:\temp2\latest_dbf.eml'))
-- from pprint import pprint as pp
-- for sub in msg.walk():
...   pp(sub.items())
...
[('Return-path', 'someone@somewhere.invalid'),
 ('Envelope-to', 'someone@somewhere.invalid'),
 ('Delivery-date', 'Mon, 07 Mar 2011 18:32:18 -0600'),
 ('Received',
  'from [72.11.125.166] (port=2728 helo=[192.168.10.136])\n\tby 
gator410.hostgator.com with esmtpa (Exim 4.69)\n\t(envelope-from 
someone@somewhere.invalid)\n\tid
 1PwkqN-0001eV-54\n\tfor someone@somewhere.invalid; Mon, 07 Mar 2011 
18:32:16 -0600'),

 ('Message-ID', '4D757B80.9020001@somewhere.invalid'),
 ('Date', 'Mon, 07 Mar 2011 16:42:40 -0800'),
 ('From', 'First Last someone@somewhere.invalid'),
 ('User-Agent', 'Thunderbird 1.5.0.10 (Windows/20070221)'),
 ('MIME-Version', '1.0'),
 ('To', 'First Last someone@somewhere.invalid'),
 ('Subject', 'latest dbf'),
 ('Content-Type',
  'multipart/mixed;\n boundary=010408020108000602070901')]

[('Content-Type', 'text/plain; charset=ISO-8859-1; format=flowed'),
 ('Content-Transfer-Encoding', '7bit')]

[('Content-Type', 'text/plain;\n name=tables.py'),
 ('Content-Transfer-Encoding', '7bit'),
 ('Content-Disposition', 'inline;\n filename=tables.py')]

[('Content-Type', 'application/x-zip-compressed;\n name=dbf-0.88.18.zip'),
 ('Content-Transfer-Encoding', 'base64'),
 ('Content-Disposition', 'inline;\n filename=dbf-0.88.18.zip')]
8-

Hope this helps!

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Remove all directories using wildcard

2011-03-18 Thread JSkinn3
I'm new to python and I am trying to figure out how to remove all sub
directories from a parent directory using a wildcard.  For example,
remove all sub directory folders that contain the word PEMA from the
parent directory C:\Data.

I've trying to use os.walk with glob, but I'm not sure if this is the
right path to take.

Thanks for any suggestions!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Remove all directories using wildcard

2011-03-18 Thread Tim Golden

On 18/03/2011 16:41, JSkinn3 wrote:

I'm new to python and I am trying to figure out how to remove all sub
directories from a parent directory using a wildcard.  For example,
remove all sub directory folders that contain the word PEMA from the
parent directory C:\Data.

I've trying to use os.walk with glob, but I'm not sure if this is the
right path to take.


You've got a few options. And it depends whether you just want
to get it done as simply as possible or whether you're using
this as a learning exercise.

Assuming it's somewhere between the two then you're on the right
track with os.walk:

code - untested
import os
import shutil

for dirpath, dirnames, filenames in os.walk (c:/data):
  for dirname in dirnames:
if pema in dirname.lower ():
  pema_path = os.path.join (dirpath, dirname)
  print Removing, pema_path
  shutil.rmtree (pema_path)
  dirnames.remove (dirname)

/code

The key is that os.walk is designed so that the dirnames
list can be mutated in place to remove directories which
are to be ignored for whatever reason. In this case, you
delete the directory tree and remove it from os.walk's
attention.

BTW the use of os.walk here is only necessary if you need to
remove *pema* directories at any level under c:\data. If
you only need those immediately under c:\data then you can
just use glob.glob in union with shutil.rmtree

TJG
--
http://mail.python.org/mailman/listinfo/python-list


RE: Remove all directories using wildcard

2011-03-18 Thread Andreas Tawn
 I'm new to python and I am trying to figure out how to remove all sub
 directories from a parent directory using a wildcard.  For example,
 remove all sub directory folders that contain the word PEMA from the
 parent directory C:\Data.
 
 I've trying to use os.walk with glob, but I'm not sure if this is the
 right path to take.
 
 Thanks for any suggestions!

I think I'd do something like this (untested).

import os, shutil

startDir = rC:\Data

for item in os.listdir(startDir):
folder = os.path.join(startDir, item)
if os.path.isdir(folder) and PEMA in item:
shutil.rmtree(folder)

Cheers,

Drea
-- 
http://mail.python.org/mailman/listinfo/python-list


multiprocessing Pool workers cannot create subprocesses

2011-03-18 Thread Jason Grout
In a recent application, a student of mine tried to create child 
processes inside of a multiprocessing Pool worker (for security and 
convenience reasons, we wanted to run some code inside of a child 
process).  Here is some test code for python 2.7:


=
import multiprocessing as mp

def run_computation(x):
print 2*x

def f(x):
curr_proc=mp.current_process()
# uncomment following line to get this to work
#curr_proc.daemon=False

p = mp.Process(target=run_computation, args=(x,))
p.start()
p.join()


pool = mp.Pool(processes=4)
pool.map(f, range(10))

===

The result is:

Traceback (most recent call last):
  File daemon.py, line 17, in module
pool.map(f, range(10))
  File 
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py, 
line 199, in map

return self.map_async(func, iterable, chunksize).get()
  File 
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py, 
line 491, in get

raise self._value
AssertionError: daemonic processes are not allowed to have children

The problem appears to be that multiprocessing sets its workers to have 
the daemon flag set to True, which prevents workers from creating child 
processes.  If I uncomment the line indicated in the code, I can create 
child processes and the program works (it prints out the even numbers 
from 0 to 18).


It makes me nervous to just change the daemon status of the process like 
that, especially when I don't know the reason the workers have 
daemon=True to begin with.  What is the reasoning behind that decision? 
 What issues do we need to worry about if we just set the daemon mode 
flag like in the above code?


Thanks,

Jason
--
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Miki Tebeka
 def bounds_check(state):
  check state values are  0 
 for attr in dir(state):
 if not attr.startswith('__') and getattr(state, attr)  0.0:
 print Error state values  0: %s % (attr)
 sys.exit()
Not that related to the question. But it's usually better to raise an exception.
Exiting in the middle of a function usually make debugging later more 
interesting.

You might find Traits interesting for validation, see 
http://code.enthought.com/projects/traits/

HTH
--
Miki Tebeka miki.teb...@gmail.com
http://pythonwise.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


ctypes pointer to structure memory swap

2011-03-18 Thread Wanderer
I'm observing some strange behavior with ctypes. I created this test
code to try to figure out what I'm doing wrong creating pointers to
structures.

from ctypes import *

class QCamSettingId(Structure):
 QCam_settings_id

_fields_ = [(f1, c_ulong),
(f2, c_ushort),
(f3, c_ushort),
(f4, c_ubyte * 8)]


class QCamSettingsEx(Structure):
 QCam_SettingsEx

_fields_ = [(size, c_ulong), # Filled by
the init routine
(pSettingsID, POINTER(QCamSettingId)),   # pointer
to the camera settings ID
(private_data, c_void_p )]   # Pointer
to a camera settings array

class QMemDriver():
 The wrapper of QCamDriver

def __init__(self):

self.QSetID = QCamSettingId()
self.QSetID_p = pointer(self.QSetID)
self.QSettings = QCamSettingsEx()
self.QSettings.pSettingsID = self.QSetID_p
self.QSettings_p = pointer(self.QSettings)

def Test(self):

Test the QCamSettinsEx object

print self.QSettings.pSettingsID
print self.QSettings.pSettingsID[0]
print self.QSettings.pSettingsID
print self.QSettings.pSettingsID[0]
print pSettingsID is at, self.QSettings.pSettingsID
print pSettingsID[0] is at, self.QSettings.pSettingsID[0]
print pSettingsID is at, self.QSettings.pSettingsID
print pSettingsID[0] is at, self.QSettings.pSettingsID[0]


The results I get are.

 qmem.Test()
QMEMTest.LP_QCamSettingId object at 0x011902B0
QMEMTest.QCamSettingId object at 0x01426850
QMEMTest.LP_QCamSettingId object at 0x011902B0
QMEMTest.QCamSettingId object at 0x01426850
pSettingsID is at QMEMTest.LP_QCamSettingId object at 0x011902B0
pSettingsID[0] is at QMEMTest.QCamSettingId object at 0x01426850
pSettingsID is at QMEMTest.LP_QCamSettingId object at 0x011902B0
pSettingsID[0] is at QMEMTest.QCamSettingId object at 0x01426850
 qmem = QMEMTest.QMemDriver()
 qmem.Test()
QMEMTest.LP_QCamSettingId object at 0x01426990
QMEMTest.QCamSettingId object at 0x014269E0
QMEMTest.LP_QCamSettingId object at 0x014269E0
QMEMTest.QCamSettingId object at 0x01426990
pSettingsID is at QMEMTest.LP_QCamSettingId object at 0x01426990
pSettingsID[0] is at QMEMTest.QCamSettingId object at 0x014269E0
pSettingsID is at QMEMTest.LP_QCamSettingId object at 0x014269E0
pSettingsID[0] is at QMEMTest.QCamSettingId object at 0x01426990

Sometimes the pointer and the object swap location and sometimes they
don't.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Katie T
On Fri, Mar 18, 2011 at 3:01 PM, Jean-Michel Pichavant 
jeanmic...@sequans.com wrote:

 Don't check for bounds, fix any bug in the code that would set your values
 out of bounds and use asserts while debugging.

 Otherwise if you really need dynamic checks, it will cost you cpu, for
 sure. Howeverver you could for instance override the __setatttr__ of state
 object, and call the attribute's associated function.


If the codes something critical (i.e. it's used for financial calculations,
hardware control, etc.) it's probably safer to test it dynamically, unless
you only have a finite number of inputs/outputs it's often hard to ensure
you've fixed all the bugs.

Katie
-- 
CoderStack
h http://www.coderstack.co.ukttp://www.coderstack.co.uk/perl-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Two random lists from one list

2011-03-18 Thread noydb
Thanks All for your responses, all a help!
-- 
http://mail.python.org/mailman/listinfo/python-list


Could I joined in this Happy family

2011-03-18 Thread duxiu xiang
Dear friends:
  I am in China.For some rearon,I cannot visit your Google Group.May
I joint this mail list for help in learning Python?

-- 
笑看嫣红染半山,逐风万里白云间。
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Could I joined in this Happy family

2011-03-18 Thread Nick Stinemates
Welcome aboard !
On Mar 18, 2011 11:34 AM, duxiu xiang xiangduxi...@gmail.com wrote:
 Dear friends:
 I am in China.For some rearon,I cannot visit your Google Group.May
 I joint this mail list for help in learning Python?

 --
 笑看嫣红染半山,逐风万里白云间。
-- 
http://mail.python.org/mailman/listinfo/python-list


class error

2011-03-18 Thread monkeys paw

I have the following file:

FileInfo.py:

import UserDict

class FileInfo(UserDict):
store file metadata
def __init__(self, filename=None):
UserDict.__init__(self)
self[name] = filename



When i import it like so:

import FileInfo


i get this error:

Traceback (most recent call last):
  File interactive input, line 1, in module
  File FileInfo.py, line 3, in module
class FileInfo(UserDict):
TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)

What is causing the error?
--
http://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing Pool workers cannot create subprocesses

2011-03-18 Thread Ned Deily
In article 4d838d28.5090...@creativetrax.com,
 Jason Grout jason-pyt...@creativetrax.com wrote:
 The problem appears to be that multiprocessing sets its workers to have 
 the daemon flag set to True, which prevents workers from creating child 
 processes.  If I uncomment the line indicated in the code, I can create 
 child processes and the program works (it prints out the even numbers 
 from 0 to 18).
 
 It makes me nervous to just change the daemon status of the process like 
 that, especially when I don't know the reason the workers have 
 daemon=True to begin with.  What is the reasoning behind that decision? 
   What issues do we need to worry about if we just set the daemon mode 
 flag like in the above code?

http://docs.python.org/library/multiprocessing.html#multiprocessing.Proce
ss.daemon

When a process exits, it attempts to terminate all of its daemonic 
child processes.

Note that a daemonic process is not allowed to create child processes. 
Otherwise a daemonic process would leave its children orphaned if it 
gets terminated when its parent process exits. Additionally, these are 
not Unix daemons or services, they are normal processes that will be 
terminated (and not joined) if non-daemonic processes have exited.

-- 
 Ned Deily,
 n...@acm.org

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class error

2011-03-18 Thread MRAB

On 18/03/2011 20:13, monkeys paw wrote:

I have the following file:

FileInfo.py:

import UserDict

class FileInfo(UserDict):
store file metadata
def __init__(self, filename=None):
UserDict.__init__(self)
self[name] = filename



When i import it like so:

import FileInfo


i get this error:

Traceback (most recent call last):
  File interactive input, line 1, in module
  File FileInfo.py, line 3, in module
class FileInfo(UserDict):
TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)

What is causing the error?


You're importing the module UserDict and then trying to create a
subclass of it.

The module UserDict contains the class UserDict.

You could write either:

import UserDict

class FileInfo(UserDict.UserDict):

or:

from UserDict import UserDict

class FileInfo(UserDict):
--
http://mail.python.org/mailman/listinfo/python-list


Re: class error

2011-03-18 Thread Ethan Furman

monkeys paw wrote:

I have the following file:

FileInfo.py:

import UserDict

class FileInfo(UserDict):
store file metadata
def __init__(self, filename=None):
UserDict.__init__(self)
self[name] = filename



When i import it like so:

import FileInfo


i get this error:

Traceback (most recent call last):
  File interactive input, line 1, in module
  File FileInfo.py, line 3, in module
class FileInfo(UserDict):
TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)

What is causing the error?


UserDict is a module -- you want to subclass the UserDict class inside 
the module...


class FileInfo(UserDict.UserDict):
etc etc

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: class error

2011-03-18 Thread Alexander Kapps

On 18.03.2011 21:13, monkeys paw wrote:

I have the following file:

FileInfo.py:

import UserDict


After this import statement, the name UserDict refers to the module.


class FileInfo(UserDict):


Here you are trying to subclass the module. What you need instead is:

class FileInfo(UserDict.UserDict):

Alternatively, import the UserDict class from the UserDict module 
like so:


from UserDict import UserDict

Note, that the UserDict class is obsolete, you can subclass the dict 
type directly:


class FileInfo(dict):
store file metadata
def __init__(self, filename=None):
dict.__init__(self)
self[name] = filename
--
http://mail.python.org/mailman/listinfo/python-list


Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-18 Thread Carl Banks
On Mar 18, 2:18 am, Duncan Booth duncan.bo...@invalid.invalid wrote:
 Terry Reedy tjre...@udel.edu wrote:
  On 3/17/2011 10:00 PM, Terry Reedy wrote:
  On 3/17/2011 8:24 PM, J Peyret wrote:
  This gives a particularly nasty abend in Windows - Python.exe has
  stopped working, rather than a regular exception stack error. I've
  fixed it, after I figured out the cause, which took a while, but
 maybe
  someone will benefit from this.

  Python 2.6.5 on Windows 7.

  class Foo(object):
  pass

  Foo.__repr__ = Foo.__str__ # this will cause an abend.

  2.7.1 and 3.2.0 on winxp, no problem, interactive intepreter or IDLE
  shell. Upgrade?

  To be clear, the above, with added indent, but with extra fluff
 (fixes)
  removed, is exactly what I ran. If you got error with anything else,
  please say so. Described behavior for legal code is a bug. However,
  unless a security issue, it would not be fixed for 2.6.

 On Windows, I can replicate this with Python 2.7, Python 3.1.2, and
 Python 3.2. Here's the exact script (I had to change the print to be
 compatible with Python 3.2):

  bug.py --
 class Foo(object):
     pass
     #def __str__(self):  #if you have this defined, no abend
     #    return a Foo

 Foo.__repr__ = Foo.__str__   # this will cause an abend.
 #Foo.__str__ = Foo.__repr__  #do this instead, no abend

 foo = Foo()
 print(str(foo))

 --

 for Python 3.2 the command:
     C:\Tempc:\python32\python bug.py

 generates a popup:

     python.exe - Application Error
     The exception unknown software exception (0xcfd) occurred in the
     application at location 0x1e08a325.

     Click on OK to terminate the program
     Click on CANCEL to debug the program

 So it looks to me to be a current bug.

Multiple people reproduce a Python hang/crash yet it looks like no one
bothered to submit a bug report

I observed the same behavior (2.6 and 3.2 on Linux, hangs) and went
ahead and submitted a bug report.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class error

2011-03-18 Thread monkeys paw

On 3/18/2011 4:43 PM, Alexander Kapps wrote:

On 18.03.2011 21:13, monkeys paw wrote:

I have the following file:

FileInfo.py:

import UserDict


After this import statement, the name UserDict refers to the module.


class FileInfo(UserDict):


Here you are trying to subclass the module. What you need instead is:

class FileInfo(UserDict.UserDict):


OK, i overlooked that and the error was not very enlightening.
Thanks very much.



Alternatively, import the UserDict class from the UserDict module like so:

from UserDict import UserDict

Note, that the UserDict class is obsolete, you can subclass the dict
type directly:

class FileInfo(dict):
store file metadata
def __init__(self, filename=None):
dict.__init__(self)
self[name] = filename


--
http://mail.python.org/mailman/listinfo/python-list


Reading/Writing files

2011-03-18 Thread Jon Herman
Hello all,

I am pretty new to Python and am trying to write data to a file. However, I
seem to be misunderstanding how to do so. For starters, I'm not even sure
where Python is looking for these files or storing them. The directories I
have added to my PYTHONPATH variable (where I import modules from
succesfully) does not appear to be it.

So my question is: How do I tell Python where to look for opening files, and
where to store new files?

Thanks,

Jon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ctypes pointer to structure memory swap

2011-03-18 Thread Nobody
On Fri, 18 Mar 2011 10:34:35 -0700, Wanderer wrote:

 I'm observing some strange behavior with ctypes. I created this test
 code to try to figure out what I'm doing wrong creating pointers to
 structures.

What makes you think that you're doing anything wrong.

Note that the hex number shown when printing a ctypes object is the
object's ID (as per the id() function). This is typically the address of
the Python object. It is not the address of the structured data nor (in
the case of a ctypes pointer) the value of the pointer.

If you want to see the actual value of a ctypes pointer, cast it to
c_void_p then examine the .value field, e.g.:

p = pointer(x)
print hex(cast(p, c_void_p).value)


-- 
http://mail.python.org/mailman/listinfo/python-list


Use cookies from a script in a browser

2011-03-18 Thread gervaz
Hi all,
I use a scraper to retrieve data from a web page.
In order to do that I need to enable cookies.
The data that I'm looking for is contained in a bunch of web pages.
Is there a way to show this web pages in a browser using the cookies
used in the script (otherwise it doesn't work).

Thanks,

Mattia
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Matt Chaput

On 18/03/2011 5:33 PM, Jon Herman wrote:

I am pretty new to Python and am trying to write data to a file.
However, I seem to be misunderstanding how to do so. For starters, I'm
not even sure where Python is looking for these files or storing them.
The directories I have added to my PYTHONPATH variable (where I import
modules from succesfully) does not appear to be it.

So my question is: How do I tell Python where to look for opening files,
and where to store new files?


This is how you write to a file in Python

myfile = open(path/to/the/file, wb)
myfile.write(Hello world!\n)
myfile.close()

Beyond that, your message is too vague to offer any real help, but it 
sounds like you're way off track. If the above code doesn't help, please 
tell us exactly what you're trying to do, but you might want to read a 
Python book such as Dive Into Python first.


Cheers,

Matt


--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jack Trades
On Fri, Mar 18, 2011 at 4:33 PM, Jon Herman jfc.her...@gmail.com wrote:

 Hello all,

 I am pretty new to Python and am trying to write data to a file. However, I
 seem to be misunderstanding how to do so. For starters, I'm not even sure
 where Python is looking for these files or storing them. The directories I
 have added to my PYTHONPATH variable (where I import modules from
 succesfully) does not appear to be it.

 So my question is: How do I tell Python where to look for opening files,
 and where to store new files?

 Thanks,

 Jon


By default Python will read and write files from the directory that your
program is run from.  This cannot always be relied upon though (for instance
if your program was imported as a module from another program).

To find out what directory your program is currently in use os.getcwd().
Here's an example I just ran...

 import os
 os.getcwd()
'/media/DATA/code/lispy/liSpy'

The folder that is returned from os.getcwd() is the folder that open will
use.  You can specify another folder by giving the full path.

open(/full/path/to/file.txt, w)

PYTHONPATH is for importing modules, which is a separate concern.

-- 
Jack Trades
Pointless Programming Blog http://pointlessprogramming.wordpress.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Ethan Furman

Jon Herman wrote:

Hello all,

I am pretty new to Python and am trying to write data to a file. 
However, I seem to be misunderstanding how to do so. For starters, I'm 
not even sure where Python is looking for these files or storing them. 
The directories I have added to my PYTHONPATH variable (where I import 
modules from succesfully) does not appear to be it.


So my question is: How do I tell Python where to look for opening files, 
and where to store new files?


There's nothing magical about it (plenty of irritating and frustrating 
if using Windows, though ;).


somefile = open('test.txt') # opens file test.txt in current directory
someotherfile = open('./stuff/misc.txt') # opens misc.txt, which lives
 # in stuff which lives in the
 # the current directory
thatfile = open(r'c:\blah\whodunit.clu') # opens whodunit.clu which
 # lives in blah off the C:
 # drive

To get the current directory, if you don't know what it is:

import os
os.getcwd()

and if you want to change the current directory:

os.chdir('/some/new/path')

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: Use cookies from a script in a browser

2011-03-18 Thread Miki Tebeka
You can use mechanize, which holds a cookie jar and can user the browser 
cookies as well.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jon Herman
Jack,

thanks.

Alright, so what I did is create a file called hello.txt with a single line
of text in there. I then did the following:

f=fulldirectory\hello.txt (where fulldirectory is of course the actual
full directory on my computer)
open(f, w)

And I get the following error: IOError: [Errno 13] Permission denied: 'f'
If I open to read, I get: IOError: [Errno 2] No such file or directory: 'f'

Can anyone explain to me why this happens?




On Fri, Mar 18, 2011 at 3:50 PM, Jack Trades jacktradespub...@gmail.comwrote:


 On Fri, Mar 18, 2011 at 4:33 PM, Jon Herman jfc.her...@gmail.com wrote:

 Hello all,

 I am pretty new to Python and am trying to write data to a file. However,
 I seem to be misunderstanding how to do so. For starters, I'm not even sure
 where Python is looking for these files or storing them. The directories I
 have added to my PYTHONPATH variable (where I import modules from
 succesfully) does not appear to be it.

 So my question is: How do I tell Python where to look for opening files,
 and where to store new files?

 Thanks,

 Jon


 By default Python will read and write files from the directory that your
 program is run from.  This cannot always be relied upon though (for instance
 if your program was imported as a module from another program).

 To find out what directory your program is currently in use os.getcwd().
 Here's an example I just ran...

  import os
  os.getcwd()
 '/media/DATA/code/lispy/liSpy'

 The folder that is returned from os.getcwd() is the folder that open will
 use.  You can specify another folder by giving the full path.

 open(/full/path/to/file.txt, w)

 PYTHONPATH is for importing modules, which is a separate concern.

 --
 Jack Trades
 Pointless Programming Blog http://pointlessprogramming.wordpress.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jack Trades
On Fri, Mar 18, 2011 at 4:56 PM, Jon Herman jfc.her...@gmail.com wrote:

 Jack,

 thanks.

 Alright, so what I did is create a file called hello.txt with a single line
 of text in there. I then did the following:

 f=fulldirectory\hello.txt (where fulldirectory is of course the actual
 full directory on my computer)
 open(f, w)

 And I get the following error: IOError: [Errno 13] Permission denied: 'f'
 If I open to read, I get: IOError: [Errno 2] No such file or directory: 'f'

 Can anyone explain to me why this happens?


You need to remove the quotes from f.  f is a variable name, not a string,
so there should be no quotes around it.

-- 
Jack Trades
Pointless Programming Blog http://pointlessprogramming.wordpress.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Dan Stromberg
For open() or os.open(), it should look in your Current Working Directory
(CWD).  Your python's CWD defaults to what the CWD was when python was
started, and it is changed with os.chdir().

Absolute paths will of course be relative to / on most OS's (or C:/ if
you're on C:, D:/ if you're on D:, etc. - IOW Windows is more complicated),
and relative paths will be relative to your CWD.

On Fri, Mar 18, 2011 at 2:33 PM, Jon Herman jfc.her...@gmail.com wrote:

 Hello all,

 I am pretty new to Python and am trying to write data to a file. However, I
 seem to be misunderstanding how to do so. For starters, I'm not even sure
 where Python is looking for these files or storing them. The directories I
 have added to my PYTHONPATH variable (where I import modules from
 succesfully) does not appear to be it.

 So my question is: How do I tell Python where to look for opening files,
 and where to store new files?

 Thanks,

 Jon

 --
 http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jack Trades
On Fri, Mar 18, 2011 at 4:59 PM, Jack Trades jacktradespub...@gmail.comwrote:



 On Fri, Mar 18, 2011 at 4:56 PM, Jon Herman jfc.her...@gmail.com wrote:

 Jack,

 thanks.

 Alright, so what I did is create a file called hello.txt with a single
 line of text in there. I then did the following:

 f=fulldirectory\hello.txt (where fulldirectory is of course the actual
 full directory on my computer)
 open(f, w)

 And I get the following error: IOError: [Errno 13] Permission denied: 'f'
 If I open to read, I get: IOError: [Errno 2] No such file or directory:
 'f'

 Can anyone explain to me why this happens?


 You need to remove the quotes from f.  f is a variable name, not a string,
 so there should be no quotes around it.


 --
 Jack Trades
 Pointless Programming Blog http://pointlessprogramming.wordpress.com


Sorry I should have given an example.  From your code it should look like
this...

filename = fulldirectory\hello.txt

You then use f to write or read.  This is how you read...

f = open(filename, r)
file_contents = f.read()
f.close()

and this is how you write...

f = open(filename, w)
f.write(hello world)
f.close()

-- 
Jack Trades
Pointless Programming Blog http://pointlessprogramming.wordpress.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Dan Stromberg
Are you on windows?

You probably should use / as your directory separator in Python, not \.  In
Python, and most other programming languages, \ starts an escape sequence,
so to introduce a literal \, you either need to prefix your string with r
(r\foo\bar) or double your backslashes (\\foo\\bar).

/ works fine on windows, and doesn't require escaping (/foo/bar).

On Fri, Mar 18, 2011 at 2:56 PM, Jon Herman jfc.her...@gmail.com wrote:

 Jack,

 thanks.

 Alright, so what I did is create a file called hello.txt with a single line
 of text in there. I then did the following:

 f=fulldirectory\hello.txt (where fulldirectory is of course the actual
 full directory on my computer)
 open(f, w)

 And I get the following error: IOError: [Errno 13] Permission denied: 'f'
 If I open to read, I get: IOError: [Errno 2] No such file or directory: 'f'

 Can anyone explain to me why this happens?





 On Fri, Mar 18, 2011 at 3:50 PM, Jack Trades 
 jacktradespub...@gmail.comwrote:


 On Fri, Mar 18, 2011 at 4:33 PM, Jon Herman jfc.her...@gmail.com wrote:

 Hello all,

 I am pretty new to Python and am trying to write data to a file. However,
 I seem to be misunderstanding how to do so. For starters, I'm not even sure
 where Python is looking for these files or storing them. The directories I
 have added to my PYTHONPATH variable (where I import modules from
 succesfully) does not appear to be it.

 So my question is: How do I tell Python where to look for opening files,
 and where to store new files?

 Thanks,

 Jon


 By default Python will read and write files from the directory that your
 program is run from.  This cannot always be relied upon though (for instance
 if your program was imported as a module from another program).

 To find out what directory your program is currently in use os.getcwd().
 Here's an example I just ran...

  import os
  os.getcwd()
 '/media/DATA/code/lispy/liSpy'

 The folder that is returned from os.getcwd() is the folder that open
 will use.  You can specify another folder by giving the full path.

 open(/full/path/to/file.txt, w)

 PYTHONPATH is for importing modules, which is a separate concern.

 --
 Jack Trades
 Pointless Programming Blog http://pointlessprogramming.wordpress.com



 --
 http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ctypes pointer to structure memory swap

2011-03-18 Thread Wanderer
On Mar 18, 5:48 pm, Nobody nob...@nowhere.com wrote:
 On Fri, 18 Mar 2011 10:34:35 -0700, Wanderer wrote:
  I'm observing some strange behavior with ctypes. I created this test
  code to try to figure out what I'm doing wrong creating pointers to
  structures.

 What makes you think that you're doing anything wrong.

 Note that the hex number shown when printing a ctypes object is the
 object's ID (as per the id() function). This is typically the address of
 the Python object. It is not the address of the structured data nor (in
 the case of a ctypes pointer) the value of the pointer.

 If you want to see the actual value of a ctypes pointer, cast it to
 c_void_p then examine the .value field, e.g.:

         p = pointer(x)
         print hex(cast(p, c_void_p).value)

In the real program the pointer to the structure is passed to the DLL.
The DLL has functions CreateCameraSettingsStruct and
ReleaseCameraSettingsStruct. Once I call CreateCameraSettingStruct, I
can't delete the pointer without crashing Python. Calling
ReleaseCameraSettingStruct doesn't help. The result is the program
crashes on exit during the class destruction. I was trying to figure
out why ReleaseCameraSettingStruct doesn't release the pointer so
Python can close the program. I was checking to see what happened
before and after ReleaseCameraSettingStruct and saw this. But it
happens even if I don't run ReleaseCameraSettingStruct.

Thanks for the reply, but I'm still not sure I understand. Why should
Object1 be at address1 and Object2 be at address2 and the next moment
Object2 is at address1 and Object1 is at address2? I'll try casting
them to see what the value is before and after calling
ReleaseCameraSettingStruct.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Alexander Kapps

On 18.03.2011 22:33, Jon Herman wrote:

Hello all,

I am pretty new to Python and am trying to write data to a file. However, I
seem to be misunderstanding how to do so. For starters, I'm not even sure
where Python is looking for these files or storing them. The directories I
have added to my PYTHONPATH variable (where I import modules from
succesfully) does not appear to be it.

So my question is: How do I tell Python where to look for opening files, and
where to store new files?

Thanks,

Jon





There is no special place where Python looks for normal files 
(PYTHONPATH is just tells where to look for modules.)


If you open a file (for reading and/or writing) and don't give an 
absolute path, then the filename is relative to the CWD (Current 
Working Directory). One can change this directory with os.chdir() 
*but* you shouldn't need to do that. Either start Python in the 
desired directory (your operating system will have a way to do this 
for icons and menu entries) or give an absolute path like:


f = open(/home/alex/test.txt)
f = open(c:/test.txt)

Also check out os.environ, a dict containing the environment 
variables. There you will find variables like $HOME or %USERPROFILE% 
(if that's correct) which tells where your personal files are:


import os

# my home directory is /home/alex
homedir = os.environ[HOME]

# creates the file /home/alex/test.txt
f = open(os.path.join(homedir, test.txt))
--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jon Herman
Folks,

thanks for the many responses! Specifying the full file name (and not using
parentheses when inappropriate, thanks Jack :)) I am now happily
reading/writing files.

My next question: what is the best way for me to write an array I generated
to a file?
And what is the best way for me to load that array again, the next time I
start up my computer?

Basically I am doing very large computations and want to store the results.

Thanks a lot guys!

Jon




On Fri, Mar 18, 2011 at 4:18 PM, Dan Stromberg drsali...@gmail.com wrote:


 Are you on windows?

 You probably should use / as your directory separator in Python, not \.  In
 Python, and most other programming languages, \ starts an escape sequence,
 so to introduce a literal \, you either need to prefix your string with r
 (r\foo\bar) or double your backslashes (\\foo\\bar).

 / works fine on windows, and doesn't require escaping (/foo/bar).

 On Fri, Mar 18, 2011 at 2:56 PM, Jon Herman jfc.her...@gmail.com wrote:

 Jack,

 thanks.

 Alright, so what I did is create a file called hello.txt with a single
 line of text in there. I then did the following:

 f=fulldirectory\hello.txt (where fulldirectory is of course the actual
 full directory on my computer)
 open(f, w)

 And I get the following error: IOError: [Errno 13] Permission denied: 'f'
 If I open to read, I get: IOError: [Errno 2] No such file or directory:
 'f'

 Can anyone explain to me why this happens?





 On Fri, Mar 18, 2011 at 3:50 PM, Jack Trades 
 jacktradespub...@gmail.comwrote:


 On Fri, Mar 18, 2011 at 4:33 PM, Jon Herman jfc.her...@gmail.comwrote:

 Hello all,

 I am pretty new to Python and am trying to write data to a file.
 However, I seem to be misunderstanding how to do so. For starters, I'm not
 even sure where Python is looking for these files or storing them. The
 directories I have added to my PYTHONPATH variable (where I import modules
 from succesfully) does not appear to be it.

 So my question is: How do I tell Python where to look for opening files,
 and where to store new files?

 Thanks,

 Jon


 By default Python will read and write files from the directory that your
 program is run from.  This cannot always be relied upon though (for instance
 if your program was imported as a module from another program).

 To find out what directory your program is currently in use os.getcwd().
 Here's an example I just ran...

  import os
  os.getcwd()
 '/media/DATA/code/lispy/liSpy'

 The folder that is returned from os.getcwd() is the folder that open
 will use.  You can specify another folder by giving the full path.

 open(/full/path/to/file.txt, w)

 PYTHONPATH is for importing modules, which is a separate concern.

 --
 Jack Trades
 Pointless Programming Blog http://pointlessprogramming.wordpress.com



 --

 http://mail.python.org/mailman/listinfo/python-list



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jack Trades
On Fri, Mar 18, 2011 at 5:21 PM, Jon Herman jfc.her...@gmail.com wrote:

 Folks,

 thanks for the many responses! Specifying the full file name (and not using
 parentheses when inappropriate, thanks Jack :)) I am now happily
 reading/writing files.

 My next question: what is the best way for me to write an array I generated
 to a file?
 And what is the best way for me to load that array again, the next time I
 start up my computer?

 Basically I am doing very large computations and want to store the results.

 Thanks a lot guys!

 Jon


To save a data structure like an array (called a list in Python), you can
use the pickle module.  Here's the documentation on pickle.

http://docs.python.org/library/pickle.html
http://www.developertutorials.com/tutorials/python/python-persistence-management-050405-1306/


-- 
Jack Trades
Pointless Programming Blog http://pointlessprogramming.wordpress.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Use cookies from a script in a browser

2011-03-18 Thread gervaz
On 18 Mar, 22:52, Miki Tebeka miki.teb...@gmail.com wrote:
 You can use mechanize, which holds a cookie jar and can user the browser 
 cookies as well.

I use:
opener =
urllib.request.build_opener(urllib.request.HTTPCookieProcessor())
urllib.request.install_opener(opener)
I start scraping from http://page.com/home.html that need the cookies
enabled, then, once I found what I was looking for, I've got
http://page.com/pageX.html and http://page.com/pageY.html. Those page
cannot be viewed if I just copy  paste the url in the browser,
because they need the cookies.

What can I do?

Thanks,
Mattia
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Westley Martínez
On Fri, 2011-03-18 at 15:56 -0600, Jon Herman wrote:
 Jack,
 
 thanks.
 
 Alright, so what I did is create a file called hello.txt with a single
 line of text in there. I then did the following:
 
 f=fulldirectory\hello.txt (where fulldirectory is of course the
 actual full directory on my computer)
 open(f, w)
 
 And I get the following error: IOError: [Errno 13] Permission denied:
 'f'
 If I open to read, I get: IOError: [Errno 2] No such file or
 directory: 'f'
 
 Can anyone explain to me why this happens?
 
 
 
 
 On Fri, Mar 18, 2011 at 3:50 PM, Jack Trades
 jacktradespub...@gmail.com wrote:
 
 
 On Fri, Mar 18, 2011 at 4:33 PM, Jon Herman
 jfc.her...@gmail.com wrote:
 Hello all,
 
 I am pretty new to Python and am trying to write data
 to a file. However, I seem to be misunderstanding how
 to do so. For starters, I'm not even sure where Python
 is looking for these files or storing them. The
 directories I have added to my PYTHONPATH variable
 (where I import modules from succesfully) does not
 appear to be it.
 
 So my question is: How do I tell Python where to look
 for opening files, and where to store new files?
 
 Thanks,
 
 Jon
 
 
 
 By default Python will read and write files from the directory
 that your program is run from.  This cannot always be relied
 upon though (for instance if your program was imported as a
 module from another program).
 
 To find out what directory your program is currently in use
 os.getcwd().  Here's an example I just ran...
 
  import os
  os.getcwd()
 '/media/DATA/code/lispy/liSpy'
 
 The folder that is returned from os.getcwd() is the folder
 that open will use.  You can specify another folder by
 giving the full path.
 
 open(/full/path/to/file.txt, w)
 
 PYTHONPATH is for importing modules, which is a separate
 concern.
 
 -- 
 Jack Trades
 Pointless Programming Blog
 
 
Don't put f in quotes. That would just make the string literal 'f'.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Martin De Kauwe

 Don't check for bounds, fix any bug in the code that would set your
 values out of bounds and use asserts while debugging.


whilst that is a nice idea in practice this just is not a practical
solution.


 Otherwise if you really need dynamic checks, it will cost you cpu, for
 sure.

Yes I agree and I hadn't decided whether to add it or not as there
aren't any current issues. However I can see that the check would
overall be safer. I was just wondering if there was some super smartie
pants solution :P


Howeverver you could for instance override the __setatttr__ of
 state object, and call the attribute's associated function.

 class State(object):
     funcTable = {
        'foo': lambda x: x = 0.0
     }

     def __init__(self):
        self.foo = 0

     def __setattr__(self, attribute, value):
        if not self.funcTable.get(attribute, lambda x: True)(value):
            sys.exit('error out of bound')
        return object.__setattr(self, attribute, value)

 Untested, however it's just an idea. I'm not even sure that would be
 less cpu consuming :D

thanks I will look at what you suggested.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Martin De Kauwe

 Offhand, my only quibble is that sys.exit is not helpful for debugging.  
 Much better to raise an error:

         if not self.funcTable.get(attribute, lambda x: True)(value):
             raise ValueError ('error out of bound')

 or define a subclass of ValueError just for this purpose.  On error, the
 program will stop just as dead, but you'll get a trace.

         Mel.

I think generally I prefer my code to die and as long as I know where
(from the statement) the error occurred I know generally what point I
have to debug up until. Can you explain how your solution would be
easier with a trace as I don't tend to use the raise/assert
functionality so I am interested.

thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ctypes pointer to structure memory swap

2011-03-18 Thread Nobody
On Fri, 18 Mar 2011 15:16:40 -0700, Wanderer wrote:

 Thanks for the reply, but I'm still not sure I understand. Why should
 Object1 be at address1 and Object2 be at address2 and the next moment
 Object2 is at address1 and Object1 is at address2? I'll try casting
 them to see what the value is before and after calling
 ReleaseCameraSettingStruct.

QCamSettingsEx is a ctypes Struct object. The pSettingsID field is a
ctypes field, not a Python field. It will contain a bare pointer to the
C-struct for the QCamSettingId object.

The point of a ctypes Struct is to store data in a format usable by C
code, i.e. the memory layout will match that of a C struct. In particular,
pointers within that struct will be pointers to C-compatible data (e.g. C
structs), not pointers to Python objects. If you access the fields from
Python, ctypes will generate Python objects on-the-fly from the raw data.

Whenever you read the pSettingsID field, ctypes will generate a ctypes
pointer object (LP_QCamSettingId?) which wraps the underlying C pointer.
If you dereference that, ctypes will generate a Python QCamSettingId
object which wraps the C struct.

As you aren't storing the references, as soon as the print statement
completes, the reference count will drop to zero and the object will be
deallocated. The next time you reference pSettingsID or pSettingsID[0], a
new object will be constructed. The addresses (and thus IDs) of the Python
objects are entirely arbitrary.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Ethan Furman

Dan Stromberg wrote:


Are you on windows?

You probably should use / as your directory separator in Python, not \.  
In Python, and most other programming languages, \ starts an escape 
sequence, so to introduce a literal \, you either need to prefix your 
string with r (r\foo\bar) or double your backslashes (\\foo\\bar).


/ works fine on windows, and doesn't require escaping (/foo/bar).


Depends on your definition of 'fine'.

-- from glob import glob
-- from pprint import pprint as pp
-- pp(glob('c:/temp/*.pdf'))
['c:/temp\\choose_python.pdf',
 'c:/temp\\COA.pdf',
 'c:/temp\\job_setup.pdf']

Visually ugly, and a pain to compare files and paths.

~Ethan~

--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Westley Martínez
On Fri, 2011-03-18 at 15:18 -0700, Dan Stromberg wrote:
 
 Are you on windows?
 
 badadvice /

You shouldn't use / or \ on Windows. You should use os.path.join(). On
Windows, when you start mixing / with \\ and spaces things can get hairy
and obscure. It's always best to just use os.path.join().








-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Dan Stromberg
Actually, I'd probably create a class with 3 arguments - an initial value, a
lower bound, and an upper bound, give it a _check method, and call _check
from the various operator methods.  The class would otherwise impersonate an
int.

In code that isn't performance-critical, it's better to check for errors on
a level that seems excessive to many; this is how I like to program - it
tends to stop bugs in their tracks, rather than allowing them to manifest
somewhere far away, elsewhere in the code,  yielding a potentially
time-consuming bug chase.  So I'll have if's and asserts checking
assumptions everywhere - at the beginning of a callable, at the end, in the
middle - inspired by Eiffel's heavy assumption checking.

Python code doesn't need to be troublesome.  I'm told this is how a famous
chess engine (was it Crafty?) got pretty much all of its bugs out.

Or if things don't need to be in the correct range every step of the way (or
rather, if they must be able to temporarily step outside their bounds), then
you could make self._check() be self.check(), and call it externally on an
as-needed basis instead.

Performance-oriented programming is fun, but not all programming is
performance-oriented, and shouldn't be treated as though it is.

On Fri, Mar 18, 2011 at 7:24 AM, Martin De Kauwe mdeka...@gmail.com wrote:

 Hi,

 if one has a set of values which should never step outside certain
 bounds (for example if the values were negative then they wouldn't be
 physically meaningful) is there a nice way to bounds check? I
 potentially have 10 or so values I would like to check at the end of
 each iteration. However as the loop is over many years I figured I
 probably want to be as optimal as possible with my check. Any
 thoughts?

 e.g. this is my solution

 # module contain data
 # e.g. print state.something might produce 4.0
 import state as state

 def main():
for i in xrange(num_days):
# do stuff

# bounds check at end of iteration
bounds_check(state)


 def bounds_check(state):
 check state values are  0 
for attr in dir(state):
if not attr.startswith('__') and getattr(state, attr)  0.0:
print Error state values  0: %s % (attr)
sys.exit()

 if __name__ == __main__:
sys.exit(main())

 thanks

 Martin
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Jon Herman
Wow, Jack, that is one awesome and simple module...thank you so much! I am
happily storing and accessing all the arrays I could ever want :)

Thanks to all for the quick assistance!




On Fri, Mar 18, 2011 at 4:24 PM, Jack Trades jacktradespub...@gmail.comwrote:


 On Fri, Mar 18, 2011 at 5:21 PM, Jon Herman jfc.her...@gmail.com wrote:

 Folks,

 thanks for the many responses! Specifying the full file name (and not
 using parentheses when inappropriate, thanks Jack :)) I am now happily
 reading/writing files.

 My next question: what is the best way for me to write an array I
 generated to a file?
 And what is the best way for me to load that array again, the next time I
 start up my computer?

 Basically I am doing very large computations and want to store the
 results.

 Thanks a lot guys!

 Jon


 To save a data structure like an array (called a list in Python), you can
 use the pickle module.  Here's the documentation on pickle.

 http://docs.python.org/library/pickle.html

 http://www.developertutorials.com/tutorials/python/python-persistence-management-050405-1306/



 --
 Jack Trades
 Pointless Programming Blog http://pointlessprogramming.wordpress.com


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing Pool workers cannot create subprocesses

2011-03-18 Thread Jason Grout

On 3/18/11 3:29 PM, Ned Deily wrote:

In article4d838d28.5090...@creativetrax.com,
  Jason Groutjason-pyt...@creativetrax.com  wrote:

The problem appears to be that multiprocessing sets its workers to have
the daemon flag set to True, which prevents workers from creating child
processes.  If I uncomment the line indicated in the code, I can create
child processes and the program works (it prints out the even numbers
from 0 to 18).

It makes me nervous to just change the daemon status of the process like
that, especially when I don't know the reason the workers have
daemon=True to begin with.  What is the reasoning behind that decision?
   What issues do we need to worry about if we just set the daemon mode
flag like in the above code?


http://docs.python.org/library/multiprocessing.html#multiprocessing.Proce
ss.daemon

When a process exits, it attempts to terminate all of its daemonic
child processes.

Note that a daemonic process is not allowed to create child processes.
Otherwise a daemonic process would leave its children orphaned if it
gets terminated when its parent process exits. Additionally, these are
not Unix daemons or services, they are normal processes that will be
terminated (and not joined) if non-daemonic processes have exited.



Right; thanks.  Let me rephrase my questions:

1. Why is important that the multiprocessing Pool worker processors have 
daemon=True (I think this is the same as asking: why is it important 
that they be terminated with terminate() rather than join() )?


2. Is it safe for us to reset a Pool worker process to have daemon=False 
before starting a subprocess from that worker, like in the code from the 
original message?


Thanks,

Jason
--
http://mail.python.org/mailman/listinfo/python-list


SocketServer.BaseRequestHandler has the data, and now?

2011-03-18 Thread ao11
Hello,

I wrote a test application to play around with UDP, the receiving part
looks like:

class proxyServer(SocketServer.ThreadingMixIn,
SocketServer.UDPServer):
pass

class proxyHandler(SocketServer.BaseRequestHandler):

def handle(self):
data   = self.request[0]
source = self.request[1]
cur_thread = threading.currentThread()
response = %s - %s: %s % (cur_thread.getName(), source,
data)
print response

class proxy(process) :

def __init__(self, id, context) :
process.__init__(self, id, context, self.run())
self.server = proxyServer((, 58889), proxyHandler)
self.thread =
threading.Thread(target=self.server.serve_forever)
self.thread.setDaemon(True)

def __del__(self) :
if self.server != None :
self.server.shutdown()

def run(self) :
self.context.model.register(self)
self.thread.start()
...
...
...

def notify(self) :
print notify  + str(self.id)

So far so good, but how do I get the data back from the handle method
to somewhere else? In my case I yust would like to add every incoming
datagram to a queue and process it later in a different thread.

How do I hand over the queue to the class
proxyHandler(SocketServer.BaseRequestHandler)?

thanks,

AO
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-18 Thread J Peyret
On Mar 18, 2:15 pm, Carl Banks pavlovevide...@gmail.com wrote:

 Multiple people reproduce a Python hang/crash yet it looks like no one
 bothered to submit a bug report

 I observed the same behavior (2.6 and 3.2 on Linux, hangs) and went
 ahead and submitted a bug report.

 Carl Banks

Speaking for myself, I've only put in one bug report on an OSS
project.  Won't do it again.

Firefox, some kinda attribute works with html, but blows up on xhtml
issue.  Nothing that was really xhtml related, but their Bugzilla
folks pulled out some unconvincing RFC crap claiming that it was out
of scope for xhtml as opposed to html so they wouldn't fix it.

Their choice.  4 yrs ago.

Still getting occasional emails from Bugzilla about that we won't fix
it for you bug.  At least 2 dozen over the years.  Nothing about
fixing it, just status churn.

If I ever specifically work on an OSS project's codeline, I'll post
bug reports, but frankly that FF example is a complete turn-off to
contributing by reporting bugs.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-18 Thread Terry Reedy

On 3/18/2011 5:15 PM, Carl Banks wrote:


Multiple people reproduce a Python hang/crash yet it looks like no one
bothered to submit a bug report


I did not because I did not initially see a problem...


I observed the same behavior (2.6 and 3.2 on Linux, hangs) and went
ahead and submitted a bug report.


http://bugs.python.org/issue11603

where I added additional comments.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading/Writing files

2011-03-18 Thread Dan Stromberg
On Fri, Mar 18, 2011 at 4:00 PM, Ethan Furman et...@stoneleaf.us wrote:

 Dan Stromberg wrote:


 Are you on windows?

 You probably should use / as your directory separator in Python, not \.
  In Python, and most other programming languages, \ starts an escape
 sequence, so to introduce a literal \, you either need to prefix your string
 with r (r\foo\bar) or double your backslashes (\\foo\\bar).

 / works fine on windows, and doesn't require escaping (/foo/bar).


 Depends on your definition of 'fine'.

 -- from glob import glob
 -- from pprint import pprint as pp
 -- pp(glob('c:/temp/*.pdf'))
 ['c:/temp\\choose_python.pdf',
  'c:/temp\\COA.pdf',
  'c:/temp\\job_setup.pdf']

 Visually ugly, and a pain to compare files and paths.


I argue that the first is quite a bit more readable than the second:
   'c:/temp/choose_python.pdf'
   os.path.join([ 'c:', 'temp', 'choose_python.pdf' ])

Also, heard of os.path.normpath?  You probably shouldn't compare pathnames
without it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-18 Thread Carl Banks
On Mar 18, 5:31 pm, J Peyret jpey...@gmail.com wrote:
 If I ever specifically work on an OSS project's codeline, I'll post
 bug reports, but frankly that FF example is a complete turn-off to
 contributing by reporting bugs.

You probably shouldn't take it so personally if they don't agree with
you.  But it's ok, it's not unreasonable to call attention to (actual)
bugs here.

I was surprised, though, when several people confirmed but no one
reported it, especially since it was a crash, which is quite a rare
thing to find.  (You should feel proud.)


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class error

2011-03-18 Thread Terry Reedy

On 3/18/2011 5:27 PM, monkeys paw wrote:

TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)

OK, i overlooked that and the error was not very enlightening.


A detailed explanation: every module is an instance of a class we will 
call Module. Every class is an instance of some class, its metaclass. 
The default metaclass, in the absence of any indication otherwise, is 
class type. So your class statement was translated to


type('FileInfo',(UserDict,), d)
where d is a dict mappint '__init__' to the function object.

type.__new__ checks the types (metaclasses) of each of the base classes. 
In particular, it sees that type(UxerDict) is Module, not type. Since it 
assumed that UserDict is a class (since you said it was), it assumed 
that Module is a proper metaclass and called

  Module('FileInfo',(UserDict,), d)
But Module is not a metaclass and does not expect the tuple of base 
classes, and Module.__new__ passed too much to Module.__init__.


Since others have made the same mistake, I opened an issue to improve 
the message.

http://bugs.python.org/issue11604

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Terry Reedy

On 3/18/2011 10:24 AM, Martin De Kauwe wrote:


def bounds_check(state):
  check state values are  0 
 for attr in dir(state):
 if not attr.startswith('__') and getattr(state, attr)  0.0:
 print Error state values  0: %s % (attr)


dir() has to do a bit a computation. I would be tempted to give 'state' 
a set of attributes to check. Call it 'nonnegatives'.

   for attr in nonnegatives:
  if ...

This allows for attributes not subject to that check.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


How to install python xlwt in ubuntu 9

2011-03-18 Thread ratna PB
Hey friends i tried a lot to unstall excel xlwt in ubuntu 9 but failed
please help me before i get full fraustrated...
-- 
http://mail.python.org/mailman/listinfo/python-list


Syntax Error

2011-03-18 Thread Manatee
I hope this is the place to post this question. I am a really new
pythonista. I am studying Tkinter and when I run this basic code, I
get  a syntax error on line 20,  print hi there, everyone. Its a
simple print line, but I can't see the problem. I am using Python
2.71, gVim for an editor, and a console window to execute the program.
Here is the link to the website that I am trying to follow:

http://www.pythonware.com/library/tkinter/introduction/hello-again.htm

Thanks for any help.


# File: hello2.py

from Tkinter import *

class App:

def __init__(self, master):

frame = Frame(master)
frame.pack()

self.button = Button(frame, text=QUIT, fg=red,
command=frame.quit)
self.button.pack(side=LEFT)

self.hi_there = Button(frame, text=Hello,
command=self.say_hi)
self.hi_there.pack(side=LEFT)

def say_hi(self):

print hi there, everyone

root = Tk()

app = App(root)

root.mainloop()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Syntax Error

2011-03-18 Thread xDog Walker
On Friday 2011 March 18 21:39, Manatee wrote:
 I hope this is the place to post this question. I am a really new
 pythonista. I am studying Tkinter and when I run this basic code, I
 get  a syntax error on line 20,  print hi there, everyone. Its a
 simple print line, but I can't see the problem. I am using Python
 2.71, gVim for an editor, and a console window to execute the program.
 Here is the link to the website that I am trying to follow:

 http://www.pythonware.com/library/tkinter/introduction/hello-again.htm

 Thanks for any help.


 # File: hello2.py

 from Tkinter import *

 class App:

 def __init__(self, master):

 frame = Frame(master)
 frame.pack()

 self.button = Button(frame, text=QUIT, fg=red,
 command=frame.quit)
 self.button.pack(side=LEFT)

 self.hi_there = Button(frame, text=Hello,
 command=self.say_hi)
 self.hi_there.pack(side=LEFT)

 def say_hi(self):

 print hi there, everyone

 root = Tk()

 app = App(root)

 root.mainloop()

Post the complete traceback.

-- 
I have seen the future and I am not in it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Syntax Error

2011-03-18 Thread Thomas L. Shinnick

At 11:39 PM 3/18/2011, Manatee wrote:

I hope this is the place to post this question. I am a really new
pythonista. I am studying Tkinter and when I run this basic code, I
get  a syntax error on line 20,  print hi there, everyone. Its a
simple print line, but I can't see the problem. I am using Python
2.71, gVim for an editor, and a console window to execute the program.
Here is the link to the website that I am trying to follow:

http://www.pythonware.com/library/tkinter/introduction/hello-again.htm

Thanks for any help.


No help, really, but copy-n-paste of the below ran fine first time on 
2.7 install on Win7.  Maybe accidental special characters in source 
file?  How about you also try copy-n-paste from your email?  Who knows  :-)



# File: hello2.py

from Tkinter import *

class App:

def __init__(self, master):

frame = Frame(master)
frame.pack()

self.button = Button(frame, text=QUIT, fg=red,
command=frame.quit)
self.button.pack(side=LEFT)

self.hi_there = Button(frame, text=Hello,
command=self.say_hi)
self.hi_there.pack(side=LEFT)

def say_hi(self):

print hi there, everyone

root = Tk()

app = App(root)

root.mainloop()
--
http://mail.python.org/mailman/listinfo/python-list


--
http://mail.python.org/mailman/listinfo/python-list


Re: Syntax Error

2011-03-18 Thread Vlastimil Brom
2011/3/19 Manatee markrri...@aol.com:
 I hope this is the place to post this question. I am a really new
 pythonista. I am studying Tkinter and when I run this basic code, I
 get  a syntax error on line 20,  print hi there, everyone. Its a
 simple print line, but I can't see the problem. I am using Python
 2.71, gVim for an editor, and a console window to execute the program.
 Here is the link to the website that I am trying to follow:

 http://www.pythonware.com/library/tkinter/introduction/hello-again.htm

 Thanks for any help.

 [...]

Hi,
the code on the mentioned page as well as yours (with adapted
indentation and wordwrapping from the mail) seems ok for python 2.

Is it possible, that you are actually using python3?
This would give something like
print hi there, everyone!
  ^
SyntaxError: invalid syntax

as print was changed to a funcion in this version.
print(hi there, everyone!)

hth,
 vbr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-18 Thread J Peyret
On Mar 18, 6:55 pm, Carl Banks pavlovevide...@gmail.com wrote:
 On Mar 18, 5:31 pm, J Peyret jpey...@gmail.com wrote:

  If I ever specifically work on an OSS project's codeline, I'll post
  bug reports, but frankly that FF example is a complete turn-off to
  contributing by reporting bugs.

 You probably shouldn't take it so personally if they don't agree with
 you.  But it's ok, it's not unreasonable to call attention to (actual)
 bugs here.


No, I didn't take the refusal personally at all, though it seemed
kinda glib to xhtml-not-hmtl out of a bug.  Such is life.

What I object to is getting auto-spammed for years after that because
I was silly enough to enter my email on their database and then being
notified about every single event on that bug.

 I was surprised, though, when several people confirmed but no one
 reported it, especially since it was a crash, which is quite a rare
 thing to find.  (You should feel proud.)

 Carl Banks

Yes, that's why I reported it.  Python is extremely stable so it
seemed worthwhile.  And I figured someone on the list would know its
bug quotient.

Impressed that there is already a bit of a proposed approach on the
entry to fix it, you guys are great.

But... I rather thought __repr__ was going to disappear in 3.x, with
just __str__ sticking around.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue11592] Compilation warnings in os module

2011-03-18 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11320] Can't call Py_SetPath() on pointer returned by Py_GetPath()

2011-03-18 Thread Palm Kevin

Palm Kevin kevin.p...@labsolution.lu added the comment:

Antoine,

Your guess that my issue initially wasn't related to virtualenv is correct 
(I've never heard about that project before posting this issue...)

As for passing the output of Py_GetPath directly to Py_SetPath: You are right, 
there is no point in doing this...
Now,  I remember that the initial problem I had was the one you reported:
Fatal Python error: Py_Initialize: Unable to get the locale encoding
LookupError: no codec search functions registered: can't find encoding

Shall I create a separate issue to report this problem?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11320
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11320] Can't call Py_SetPath() on pointer returned by Py_GetPath()

2011-03-18 Thread Palm Kevin

Palm Kevin kevin.p...@labsolution.lu added the comment:

Furthermore I would propose to rename this issue: The problem is not that 
Py_SetPath cannot be called on pointer returned by Py_GetPath. I think that the 
problem is more general: Calling Py_SetPath NEVER works.

-- I get the same exception as documented in my initial post when calling 
Py_SetPyth like this:
   Py_SetPath(L/usr/labsolution/python32/lib/python3.2/);
or like this:
  wchar_t * path;
  path = malloc(128 * sizeof(wchar_t));
  wcscpy(path,L/usr/labsolution/python32/lib/python3.2/);
  Py_SetPath(path);

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11320
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11320] Can't call Py_SetPath() on pointer returned by Py_GetPath()

2011-03-18 Thread Palm Kevin

Palm Kevin kevin.p...@labsolution.lu added the comment:

As for this error:
  Fatal Python error: Py_Initialize: Unable to get the locale encoding
  LookupError: no codec search functions registered: can't find encoding

It seems to me that this error appears if the path passed to Py_SetPath does 
not point to a valid python lib folder.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11320
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11593] Add encoding parameter to logging.basicConfig

2011-03-18 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

I've been thinking about adding a handler= keyword argument to basicConfig(), 
and it seems to me that it would not only cover your use case, but also other 
cases which require different handlers.

So I'm marking as wontfix for now, but I'll keep the issue open until the 
handler parameter gets added. Also changing this to Python 3.3, as I can't make 
API changes to 3.2.

--
assignee:  - vinay.sajip
resolution:  - wont fix
versions: +Python 3.3 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11593
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11572] bring Lib/copy.py to 100% coverage

2011-03-18 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

A little research has found that building without complex is not possible 
anymore, so you’re good: http://bugs.python.org/issue7147

Regarding “unicode”, see line 112.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10914] Python sub-interpreter test

2011-03-18 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

 Well, config._link() seems to do what is needed here.
My point is that it’s easier to write a few lines of code directly using a 
compiler object (copying and simplifying code from try_run or _link) than go 
through the distutils command machinery.  Both are doable, but I think the 
former is easier.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10914
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11591] python -S should be robust against e.g. from site import addsitedir

2011-03-18 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Fair argument.  Brett is the author of recent changes in site, let him decide.

Brett: Would you agree to 1)?

--
nosy: +brett.cannon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11591
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1195] Problems on Linux with Ctrl-D and Ctrl-C during raw_input

2011-03-18 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Instead of always calling clearerr(), we can only call it on EOF:

diff -r 88fe1ac48460 Parser/myreadline.c
--- a/Parser/myreadline.c   Mon Mar 07 08:31:52 2011 +0100
+++ b/Parser/myreadline.c   Fri Mar 18 10:57:23 2011 +0100
@@ -72,6 +72,7 @@
 }
 #endif /* MS_WINDOWS */
 if (feof(fp)) {
+clearerr(fp);
 return -1; /* EOF */
 }
 #ifdef EINTR

This patch works around this issue.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1195
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11320] Can't call Py_SetPath() on pointer returned by Py_GetPath()

2011-03-18 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 As for this error:
   Fatal Python error: Py_Initialize: Unable to get the locale encoding
   LookupError: no codec search functions registered: can't find encoding
 
 It seems to me that this error appears if the path passed to
 Py_SetPath does not point to a valid python lib folder.

Indeed, it does. The error message could perhaps get improved.
What Python does is try to find the current locale's encoding in the
encodings package and load it. If it can't find it, it assumes that's
because the encoding is unknown, not because the path is wrong.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11320
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11575] addresses.txt file leaks into search engines

2011-03-18 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

Why should we have this file served on the web itself? Cannot it be on server 
outside of www ( or any directory which is getting served). I would vote for 
this.

--
nosy: +orsenthil

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11575
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11575] addresses.txt file leaks into search engines

2011-03-18 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

The question is not why, it is how. This file is part of the scripts used 
to migrate from svn to hg. These files themselves were maintained in an hg 
repository (it could have been an svn repository), for obvious practical 
reasons. And that repository was online since there didn't seem any reason to 
do otherwise (and, again, it's more practical).

We could of course make this repo less visible now (but I think we still need 
to migrate the peps repo). Georg?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11575
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11549] Rewrite peephole to work on AST

2011-03-18 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
nosy: +mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11549
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11574] Unicode Fallback Encoding on Python 3.3

2011-03-18 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

After reading the related mail thread on python-dev, I realized that you are 
talking about TextIOWrapper choice (file content, not file name). My previous 
message is about file names.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11574
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11572] bring Lib/copy.py to 100% coverage

2011-03-18 Thread Brandon Craig Rhodes

Brandon Craig Rhodes bran...@rhodesmill.org added the comment:

Éric, after checking line 112 of the two patches and then of the new file, I 
figured out that you meant line 112 of the old file — and, yes, that test can 
go away too since in python3 complex always exists and unicode never 
exists. A further improved patch (#3) is attached.

--
Added file: http://bugs.python.org/file21276/test_copy3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11574] Unicode Fallback Encoding on Python 3.3

2011-03-18 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

TextIOWrapper is mostly based on locale.getpreferredencoding(), so msg131290 is 
still valid: if no env var is set, nl_langinfo() gives 'ASCII' (or something 
like that). But it is not easy to detect that env vars are not set.

I would prefer a completly different approach: always use UTF-8 by default if 
the encoding is not set.

Something like:
def open(filename, ..., encoding='UTF-8', ...)
TextIOWrapper.__init__(..., encoding='UTF-8', ...)

So not rely on locales anymore.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11574
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11581] buildbot error when pushing to 2.5 branch?

2011-03-18 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I talked to Martin.  He wants the 2.5 mercurial branch to get *exactly* that 
set of changes that needs to be applied to the svn repository in order for him 
to build the security release, no more no less.  Note that 2.5 goes out of 
security maintenance in November.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11581
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11581] buildbot error when pushing to 2.5 branch?

2011-03-18 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

David, from you message I understand that Martin is planning to
release 2.5 via svn.  If that is the case, whatever was pushed for
security fix to hg can remain as such and so that those can be
exported to svn. 

The bugs related to buildbot and svn keyword for 2.5, can then be
ignored and closed.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11581
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11581] buildbot error when pushing to 2.5 branch?

2011-03-18 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Yes, although there may be another answer on the compile bug.

--
resolution:  - wont fix
stage:  - committed/rejected
status: open - closed
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11581
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11513] chained exception/incorrect exception from tarfile.open on a non-existent file

2011-03-18 Thread Evan Dandrea

Evan Dandrea e...@ubuntu.com added the comment:

David,

Thanks for the pointers. I've updated the patch hopefully adequately addressing 
your concerns.

--
components: +Interpreter Core -Library (Lib)
type: behavior - 
Added file: 
http://bugs.python.org/file21277/tarfile-fix-multiple-exception-on-enoent.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11513
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11513] chained exception/incorrect exception from tarfile.open on a non-existent file

2011-03-18 Thread Evan Dandrea

Changes by Evan Dandrea e...@ubuntu.com:


Removed file: 
http://bugs.python.org/file21223/tarfile-fix-multiple-exception-on-enoent.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11513
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11579] python 2.5 does not build from hg - looks for subversion keywords

2011-03-18 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I talked to Martin about this at the sprints.  He wants the set of patches in 
the 2.5 hg repo to be exactly those that he should apply to svn to build the 
next release, no more no less.  If someone wants to propose a patch that fixes 
the hg compile but does not break the svn compile, he would find that 
acceptable.  Alternatively the hg repo could be fixed, for our convenience, 
after 2.5 goes out of maintenance in November.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11579
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11594] 2to3 tool does not preserve line-endings

2011-03-18 Thread Alexander Belchenko

New submission from Alexander Belchenko bia...@ukr.net:

I'm using LF-only line-endings for development of my IntelHex library. I'm 
working on Windows most of the time.

After 2to3 tool has been ran on my library it has not only changed the Python 
syntax, but it also saved all files with CRLF line-endings. As result I have 
all changed files completelly modified and diff shows change in every line. 

2to3 tool should respect my line-endings and must not use simple open(xxx, 
wt) mode for writing modified files.

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 131335
nosy: bialix
priority: normal
severity: normal
status: open
title: 2to3 tool does not preserve line-endings
type: behavior
versions: Python 2.7, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11594
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >