Re: [ANN] bzr 2.4.1 released (errata)

2011-09-14 Thread Vincent Ladeuil
 Vincent Ladeuil  typo'ed:

 Bazaar is now available for download from
 https://launchpad.net/bzr/2.4/2.4b4/ as a source tarball.

Errata, this should read:

   https://launchpad.net/bzr/2.4/2.4.1 

of course,

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

Support the Python Software Foundation:
http://www.python.org/psf/donations/


New project | quicli: write command line interfaces quickly

2011-09-14 Thread Kyle Alan Hale
Quicli is a wrapper around Python's built in argparse module.  While
argparse focuses on a comprehensive set of features, quicli emphasizes
a simple, easy-to-use interface, driven by function metadata and
decorators, with integrated data validation.

This isn't meant to replace argparse (it depends on it, actually) but
to enhance it. Where argparse is strong, quicli reinforces. Where
argparse is bulky, quicli is svelte.  What quicli lacks, it still
allows argparse to provide.

For usage and installation instructions, visit http://
dev.kylealanhale.com/wiki/projects/quicli

Features:
* Major argparse features are implemented and accessible via function
decorators
* Introspects default values for argument names and types, as well as
program name, description, and help message
* Simple validation of user input
* An extended FileType object
* The ability to restart a program on error (optionally with different
input values than were initially provided) for seamless error recovery
* Progress context managers (visual feedback helpers, including a text-
based progress bar)
* Unit tests for all of the above
* Extensive documentation

This is my first public python project, so I'm eager for feedback from
the community.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


A documents editor in Firefox with Python Sphinx tool

2011-09-14 Thread 文山 杜
Baow is a tool that makes it easy to organize your internet resources
and create intelligent and beautiful web pages within Firefox web
browser.

Highlights :

 * Tree based outline, help you organize internet resources and
documents.
 * Save or bookmark web images, files or pages.
 * Multi level project management.
 * Full text search.
 * Generate web pages by Python Sphinx tools,  http://sphinx.pocoo.org
. Lots of quick menus help you write and preview Python Sphinx and
reStructuredText markup documents.
 * Multi platform support, Windows, Linux, Mac, etc.

Home page:  https://addons.mozilla.org/en-US/firefox/addon/baow/

Help:  http://www.baow.com/help/
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Problem with Dos command by python script

2011-09-14 Thread Jonatas Emidio
Here i come!!

I have the following problem...
I need run by python script a string with some DOS commands - Windows
prompt!!
For exemple:
print 'cd temp'
print 'mkdir temp_app'

How can i run this string in the python, but as a DOS interpreter?
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2011-09-14 Thread Vincent Vande Vyvre


  
  
Le 13/09/11 22:20, Arnaud Delobelle a crit:

  Hi all,

Unpyc3 can recreate Python3 source code from code objects, function
source code from function objects, and module source code from .pyc
files. The current version is able to decompile itself successfully
:). It has been tested with Python3.2 only.

It currently reconstructs most of Python 3 (see TODO below) constructs
but probably needs to be tested more thoroughly. All feedback welcome.

Unpyc3 is a single file and is available at http://code.google.com/p/unpyc3/

Example:


  

  
from unpyc3 import decompile
def foo(x, y, z=3, *args):

  

  
  ...global g
...for i, j in zip(x, y):
...if z == i + j or args[i] == j:
...g = i, j
...return
...

  

  
print(decompile(foo))

  

  
  def foo(x, y, z=3, *args):
global g
for i, j in zip(x, y):
if z == i + j or args[i] == j:
g = i, j
return

TODO:

* Support for keyword-only arguments
* Handle assert statements
* Show docstrings for functions and modules
* Nice spacing between function/class declarations

Have fun!

Note: unpyc3 is totally unrelated to another project called "unpyc"
which I discovered when I tried to register the same project name on
google code.



Hi, trying your code, I have had numbers of errors:

 File "unpyc3.py", line 55, in module
 SETUP_WITH,
NameError: name 'SETUP_WITH' is not defined

commented it

 File "unpyc3.py", line 58, in module
 STORE_DEREF, DELETE_DEREF,
NameError: name 'DELETE_DEREF' is not defined

commented it

 File "unpyc3.py", line 96, in dec_module
 stream = open(pyc_path, "rb")
UnboundLocalError: local variable 'pyc_path' referenced before
assignment

change pyc_path to path

 File "unpyc3.py", line 98, in dec_module
 code = Code(code_obj)
 File "unpyc3.py", line 210, in __init__
 for v in code_obj.co_cellvars + code_obj.co_freevars]
AttributeError: 'NoneType' object has no attribute 'co_cellvars'

...

Cheers

-- 
  Vincent V.V.
  Oqapy . Qarte+7 . PaQager
  


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


memory error

2011-09-14 Thread questions anon
Hello All,
I keep coming across a memory error when processing many netcdf files. I
assume it has something to do with how I loop things and maybe need to close
things off properly.
In the code below I am looping through a bunch of netcdf files (each file is
hourly data for one month) and within each netcdf file I am outputting a
*png file every three hours.
This works for one netcdf file but when it begins to process the next netcdf
file I receive this memory error:

*Traceback (most recent call last):
  File
d:/plot_netcdf_merc_multiplot_across_multifolders_mkdirs_memoryerror.py,
line 44, in module
TSFC=ncfile.variables['T_SFC'][:]
  File netCDF4.pyx, line 2473, in netCDF4.Variable.__getitem__
(netCDF4.c:23094)
MemoryError*

To reduce processing requirements I have tried making the LAT and LON to
only use [0] but I also receive an error:

*Traceback (most recent call last):
  File
d:/plot_netcdf_merc_multiplot_across_multifolders_mkdirs_memoryerror.py,
line 75, in module
x,y=map(*N.meshgrid(LON,LAT))
  File C:\Python27\lib\site-packages\numpy\lib\function_base.py, line
3256, in meshgrid
numRows, numCols = len(y), len(x)  # yes, reversed
TypeError: len() of unsized object*

finally I have added gc.collect() in a couple of places but that doesn't
seem to do anything to help.
I am using :*Python 2.7.2 |EPD 7.1-2 (32-bit)| (default, Jul  3 2011,
15:13:59) [MSC v.1500 32 bit (Intel)] on win32*
Any feedback will be greatly appreciated!


from netCDF4 import Dataset
import numpy
import numpy as N
import matplotlib.pyplot as plt
from numpy import ma as MA
from mpl_toolkits.basemap import Basemap
from netcdftime import utime
from datetime import datetime
import os
import gc

print start processing

inputpath=r'E:/GriddedData/Input/'
outputpath=r'E:/GriddedData/Validation/'
shapefile1=E:/test_GIS/DSE_REGIONS
for (path, dirs, files) in os.walk(inputpath):
for dir in dirs:
print dir
sourcepath=os.path.join(path,dir)
relativepath=os.path.relpath(sourcepath,inputpath)
newdir=os.path.join(outputpath,relativepath)
if not os.path.exists(newdir):
os.makedirs(newdir)

for ncfile in files:
if ncfile[-3:]=='.nc':
print dealing with ncfiles:, ncfile
ncfile=os.path.join(sourcepath,ncfile)
#print ncfile
ncfile=Dataset(ncfile, 'r+', 'NETCDF4')
TSFC=ncfile.variables['T_SFC'][:,:,:]
TIME=ncfile.variables['time'][:]
LAT=ncfile.variables['latitude'][:]
LON=ncfile.variables['longitude'][:]
fillvalue=ncfile.variables['T_SFC']._FillValue
TSFC=MA.masked_values(TSFC, fillvalue)
ncfile.close()
gc.collect()
print garbage collected


for TSFC, TIME in zip((TSFC[1::3]),(TIME[1::3])):
print TSFC, TIME
#convert time from numbers to date and prepare it to have no
symbols for saving to filename
cdftime=utime('seconds since 1970-01-01 00:00:00')
ncfiletime=cdftime.num2date(TIME)
print ncfiletime
timestr=str(ncfiletime)
d = datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S')
date_string = d.strftime('%Y%m%d_%H%M')

#Set up basemap using mercator projection
http://matplotlib.sourceforge.net/basemap/doc/html/users/merc.html
map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,

llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')

# compute map projection coordinates for lat/lon grid.
x,y=map(*N.meshgrid(LON,LAT))
map.drawcoastlines(linewidth=0.5)
map.readshapefile(shapefile1, 'DSE_REGIONS')
map.drawstates()

plt.title('Surface temperature at %s UTC'%ncfiletime)
ticks=[-5,0,5,10,15,20,25,30,35,40,45,50]
CS = map.contourf(x,y,TSFC, ticks, cmap=plt.cm.jet)
l,b,w,h =0.1,0.1,0.8,0.8
cax = plt.axes([l+w+0.025, b, 0.025, h], )
cbar=plt.colorbar(CS, cax=cax, drawedges=True)

#save map as *.png and plot netcdf file

plt.savefig((os.path.join(newdir,'TSFC'+date_string+'UTC.png')))
plt.close()
gc.collect()
print garbage collected again
print end of processing
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2011-09-14 Thread Arnaud Delobelle
On 14 September 2011 06:53, Vincent Vande Vyvre
vincent.vandevy...@swing.be wrote:

 Hi, trying your code, I have had numbers of errors:

Hi Vincent, thanks for trying it.

   File unpyc3.py, line 55, in module
     SETUP_WITH,
 NameError: name 'SETUP_WITH' is not defined

 commented it

   File unpyc3.py, line 58, in module
     STORE_DEREF, DELETE_DEREF,
 NameError: name 'DELETE_DEREF' is not defined

 commented it

What version of Python are you running this on?  This is module is
written for Python 3.  It looks like you're using an old version of
Python (before the with statement was introduced - 2.5?)

   File unpyc3.py, line 96, in dec_module
     stream = open(pyc_path, rb)
 UnboundLocalError: local variable 'pyc_path' referenced before assignment

 change pyc_path to path

Thanks, I've fixed that.

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


Re: stackoverflow and c.l.py

2011-09-14 Thread Ethan Furman

Steven D'Aprano wrote:

On Wed, 14 Sep 2011 02:12 pm Stefan Behnel wrote:


Matt Joiner, 14.09.2011 04:23:

i'm curious as to what can be done with (and handled better) by
adjusting sys.setswitchinterval
i've opened a question on SO for this, that people might find of
interest: http://stackoverflow.com[...]

I wonder why people ask this kind of question on stackoverflow, and then
come here asking people to go over there, read the question, and
(potentially) provide an answer.


You should post that question on stackoverflow, and ask them to reply here.


+10!
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Usenet newsgroup news:comp.lang.python ...

2011-09-14 Thread Dave Angel

On 01/-10/-28163 02:59 PM, mano mano wrote:

Mikael Lyngvig accurately summarizes comp.lang.python discussion of
the technical merits of Tkinter, wxPython, and Python-bound JPI.
Malcolm Tredinnick ...

http://12..89/


SPAM ALERT

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


Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2011-09-14 Thread Vincent Vande Vyvre


  
  
Le 14/09/11 08:20, Arnaud Delobelle a écrit :

  On 14 September 2011 06:53, Vincent Vande Vyvre
vincent.vandevy...@swing.be wrote:

  

Hi, trying your code, I have had numbers of errors:

  
  
Hi Vincent, thanks for trying it.


  
  File "unpyc3.py", line 55, in module
    SETUP_WITH,
NameError: name 'SETUP_WITH' is not defined

commented it

  File "unpyc3.py", line 58, in module
    STORE_DEREF, DELETE_DEREF,
NameError: name 'DELETE_DEREF' is not defined

commented it

  
  
What version of Python are you running this on?  This is module is
written for Python 3.  It looks like you're using an old version of
Python (before the with statement was introduced - 2.5?)


  
  File "unpyc3.py", line 96, in dec_module
    stream = open(pyc_path, "rb")
UnboundLocalError: local variable 'pyc_path' referenced before assignment

change pyc_path to path

  
  
Thanks, I've fixed that.

--
Arnaud



Python 3.1.2 (r312:79147, Sep 27 2010, 09:45:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more
information.

I'll retry later on an other pc where I have a v.3.2

-- 
  Vincent V.V.
  Oqapy . Qarte+7 . PaQager
  


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


Re: stackoverflow and c.l.py (was: GIL switch interval)

2011-09-14 Thread Duncan Booth
Stefan Behnel stefan...@behnel.de wrote:

 Matt Joiner, 14.09.2011 04:23:
 i'm curious as to what can be done with (and handled better) by
 adjusting sys.setswitchinterval
 i've opened a question on SO for this, that people might find of
 interest: http://stackoverflow.com[...]
 
 I wonder why people ask this kind of question on stackoverflow, and
 then come here asking people to go over there, read the question, and 
 (potentially) provide an answer.
 
 IMHO, c.l.py is a much better place to ask Python(-related) questions
 than stackoverflow. It's also a much better place to search for an
 answer that is already available in the archives.
 
If you want an answer to how to get a specific bit of code to work then 
Stackoverflow is better if only because people can see who has already 
answered so don't need to waste time re-answering every trivial little 
question about syntax.

Also there's a theory that people can search for existing answers so only 
one person in the class has to ask how to do their homework. I've never 
actually asked a question on Stackoverflow but I have found the answers to 
a lot of problems I've had.

If you want an open-ended discussion then c.l.py is the place to go. On 
Stackoverflow you would likely just have the question closed pdq.

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


Re: Connection reset by peer

2011-09-14 Thread Thomas Jollans
On 14/09/11 04:39, 守株待兔 wrote:
 i  want to know,  my  computer(client)  reset  it  ,or  the yahoo
 (server)  reset it ,what is the peer?? 

This refers to your program's peer, as in the entity it's communicating
with. When you're the client, the other party (which, once the
connection is established, is considered to be of equal rank - a peer)
is the server.

tl;dr: yahoo.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2011-09-14 Thread Vincent Vande Vyvre


  
  
Le 14/09/11 10:13, Vincent Vande Vyvre a écrit :

  
  Le 14/09/11 08:20, Arnaud Delobelle a écrit :
  
On 14 September 2011 06:53, Vincent Vande Vyvre
vincent.vandevy...@swing.be wrote:


  Hi, trying your code, I have had numbers of errors:


Hi Vincent, thanks for trying it.



    File "unpyc3.py", line 55, in module
    SETUP_WITH,
NameError: name 'SETUP_WITH' is not defined

commented it

  File "unpyc3.py", line 58, in module
    STORE_DEREF, DELETE_DEREF,
NameError: name 'DELETE_DEREF' is not defined

commented it


What version of Python are you running this on?  This is module is
written for Python 3.  It looks like you're using an old version of
Python (before the with statement was introduced - 2.5?)



    File "unpyc3.py", line 96, in dec_module
    stream = open(pyc_path, "rb")
UnboundLocalError: local variable 'pyc_path' referenced before assignment

change pyc_path to path


Thanks, I've fixed that.

--
Arnaud


  
  Python 3.1.2 (r312:79147, Sep 27 2010, 09:45:41) 
  [GCC 4.4.3] on linux2
  Type "help", "copyright", "credits" or "license" for more
  information.
  
  I'll retry later on an other pc where I have a v.3.2
  
  -- 
Vincent V.V.
Oqapy
. Qarte+7 . PaQager


Python 3.2.1 (default, jul 11 2011, 12:37:47) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more
information.

This one on Archlinux

Again the last error:

  File "unpyc3.py", line 211, in __init__
    for v in code_obj.co_cellvars + code_obj.co_freevars]
AttributeError: 'NoneType' object has no attribute 'co_cellvars'
-- 
  Vincent V.V.
  Oqapy . Qarte+7 . PaQager
  


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


www.brunningonline.net/simon/blog/archives/001919.html

2011-09-14 Thread Selvi Arul
http://123maza.com/65/orange458/
-- 
http://mail.python.org/mailman/listinfo/python-list


Replace pip installed package with latest git version?

2011-09-14 Thread Alec Taylor
Good evening,

I've installed a version of python-creole from pip. How do I upgrade
it to the latest git version?

(Windows 7 x64 SP1)

Thanks for all suggestions,

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


Python Shutdown hook comp.lang.python. My comp.lang.python post.....

2011-09-14 Thread Selvi Arul
http://123maza.com/65/orange458/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2011-09-14 Thread Arnaud Delobelle
On 14 September 2011 09:44, Vincent Vande Vyvre
vincent.vandevy...@swing.be wrote:
   File unpyc3.py, line 211, in __init__
     for v in code_obj.co_cellvars + code_obj.co_freevars]
 AttributeError: 'NoneType' object has no attribute 'co_cellvars'

Could you show me what you do to get this error?  Thank you,

Arnaud

PS: I've checked; DELETE_DEREF was introduced in Python3.2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2011-09-14 Thread Vincent Vande Vyvre


  
  
Le 14/09/11 11:31, Arnaud Delobelle a écrit :

  On 14 September 2011 09:44, Vincent Vande Vyvre
vincent.vandevy...@swing.be wrote:

  
  File "unpyc3.py", line 211, in __init__
    for v in code_obj.co_cellvars + code_obj.co_freevars]
AttributeError: 'NoneType' object has no attribute 'co_cellvars'

  
  
Could you show me what you do to get this error?  Thank you,

Arnaud

PS: I've checked; DELETE_DEREF was introduced in Python3.2



[vincent@myhost unpyc3]$ python
Python 3.2.1 (default, Jul 11 2011, 12:37:47) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
 from unpyc3 import decompile
 print (decompile("shredder.pyc"))
Traceback (most recent call last):
  File "stdin", line 1, in module
  File "unpyc3.py", line 110, in decompile
    return dec_module(obj)
  File "unpyc3.py", line 99, in dec_module
    code = Code(code_obj)
  File "unpyc3.py", line 211, in __init__
    for v in code_obj.co_cellvars + code_obj.co_freevars]
AttributeError: 'NoneType' object has no attribute 'co_cellvars'
 print (decompile("unpyc3.pyc"))
Traceback (most recent call last):
  File "stdin", line 1, in module
  File "unpyc3.py", line 110, in decompile
    return dec_module(obj)
  File "unpyc3.py", line 99, in dec_module
    code = Code(code_obj)
  File "unpyc3.py", line 211, in __init__
    for v in code_obj.co_cellvars + code_obj.co_freevars]
AttributeError: 'NoneType' object has no attribute 'co_cellvars'
 import os
 os.path.isfile("shredder.pyc")
True
 os.path.isfile("unpyc3.pyc")
True


it seems the return of marshal.load(stream) is None

-- 
  Vincent V.V.
  Oqapy . Qarte+7 . PaQager
  


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


Re: stackoverflow and c.l.py

2011-09-14 Thread memilanuk

On 09/13/2011 09:12 PM, Stefan Behnel wrote:

Matt Joiner, 14.09.2011 04:23:

i'm curious as to what can be done with (and handled better) by
adjusting sys.setswitchinterval
i've opened a question on SO for this, that people might find of
interest: http://stackoverflow.com[...]


I wonder why people ask this kind of question on stackoverflow, and then
come here asking people to go over there, read the question, and
(potentially) provide an answer.

IMHO, c.l.py is a much better place to ask Python(-related) questions
than stackoverflow. It's also a much better place to search for an
answer that is already available in the archives.

Stefan



Just an opinion from the unwashed masses... but I don't see the p0rn 
spam over on SO that I do on c.l.py, for one.  I also seem to generally 
get better results from the search engine there, for two.  Not saying 
one is necessarily better than the other, but just subscribing to the 
feed for the [python] tag on SO has a pretty good SNR...


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


Re: stackoverflow and c.l.py

2011-09-14 Thread Chris Angelico
On Wed, Sep 14, 2011 at 10:33 PM, memilanuk memila...@gmail.com wrote:
 Not saying one is necessarily better than the other, but just subscribing to
 the feed for the [python] tag on SO has a pretty good SNR...

The SNR here isn't bad either. Most of the spam gets filtered out, and
even stuff like Ranting Rick posts can be of some amusement when it's
a slow day...

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


Re: stackoverflow and c.l.py

2011-09-14 Thread memilanuk

On 09/14/2011 05:47 AM, Chris Angelico wrote:

The SNR here isn't bad either. Most of the spam gets filtered out, and
even stuff like Ranting Rick posts can be of some amusement when it's
a slow day...


I subscribe to the list via Gmane, and if 'most of the spam' gets 
filtered out, I'd hate to see how much gets submitted as I still see 2-5 
minimum blatant spam per day on here.


Rick  Xang Li are two examples of what you *don't* see (or at least I 
don't) @ SO


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


Re: stackoverflow and c.l.py

2011-09-14 Thread Laszlo Nagy

On 2011-09-14 15:05, memilanuk wrote:


Rick  Xang Li are two examples of what you *don't* see (or at least I 
don't) @ SO

I knew Xang's name would come up. :-) Epic.

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


Twisted Perspective Broker: get client ip

2011-09-14 Thread Andrea Di Mario
Hi, i'm writing a perspective broker server. Now, i should get the
client IP, that perspective broker writes well in the log. I've tried
to get it from MyRealm with: mind.broker.transport.getPeer(), without
success. I've tried self.transport.getPeer() to, with this result:
exceptions.AttributeError: Listner instance has no attribute 'transport'
It's strange, because PB wrote the client IP, infact in log i've line with:
2011-09-11 16:41:58+0200 [Broker,0,127.0.0.1] 

Could you suggest me something?
Thanks.
Here the code:

from OpenSSL import SSL
from twisted.internet import reactor, ssl
from ConfigParser import SafeConfigParser
from twisted.python import log
from twisted.spread import pb
from twisted.cred import checkers, portal
from zope.interface import implements
import hashlib

class Listner(pb.Avatar):

   def __init__(self, name):
   self.name = name

   def perspective_getDictionary(self, dictionary):
  print dictionary

   def perspective_simplyAccess(self, access):
  print access

def verifyCallback(connection, x509,  errnum, errdepth, ok):
   if not ok:
  log.msg(Certificato non valido: %s % x509.get_subject())
  return False
   else:
  log.msg(Connessione stabilita, vertificato valido: %s %
x509.get_subject())
   return True


class MyRealm:
implements(portal.IRealm)
def requestAvatar(self, avatarId, mind, *interfaces):
if pb.IPerspective not in interfaces:
raise NotImplementedError
return pb.IPerspective, Listner(avatarId), lambda:None


if __name__ == __main__:

   CONFIGURATION = SafeConfigParser()
   CONFIGURATION.read('server.conf')
   PORT = CONFIGURATION.get('general', 'port')
   LOGFILE = CONFIGURATION.get('general', 'log')

log.startLogging(open(LOGFILE,'a'))


   myContextFactory =
ssl.DefaultOpenSSLContextFactory(CONFIGURATION.get('general',
'keypath'), CONFIGURATION.get('general', 'certpath'))
   ctx = myContextFactory.getContext()
   ctx.set_verify(SSL.VERIFY_PEER |
SSL.VERIFY_FAIL_IF_NO_PEER_CERT, verifyCallback)

   ctx.load_verify_locations(CONFIGURATION.get('general', 'cacert'))

   p = portal.Portal(MyRealm())
   c = checkers.FilePasswordDB('passwords.txt',
caseSensitive=True, cache=True)
   p.registerChecker(c)
   factory = pb.PBServerFactory(p)
   reactor.listenSSL(int(PORT), factory, myContextFactory)
   reactor.run()

-- 
Andrea Di Mario
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stackoverflow and c.l.py (was: GIL switch interval)

2011-09-14 Thread Roy Smith
In article Xns9F605E618E6B1duncanbooth@127.0.0.1,
 Duncan Booth duncan.booth@invalid.invalid wrote:

 If you want an answer to how to get a specific bit of code to work then 
 Stackoverflow is better if only because people can see who has already 
 answered so don't need to waste time re-answering every trivial little 
 question about syntax.

Any halfway decent newsreader application will follow threading and put 
all the responses to a given question in one place.  Of course, this is 
a relatively new feature.  If your newsreader is any older than about 
the mid 1980's, it may not be able to do this.

In article mailman.1100.1315973589.27778.python-l...@python.org,
 Stefan Behnel stefan...@behnel.de wrote:

 I wonder why people ask this kind of question on stackoverflow, and then 
 come here asking people to go over there, read the question, and 
 (potentially) provide an answer.

If you ask here you will probably get the correct answer to your 
question (along with some deep dives into related topics, which are 
often more valuable than the original answer).  If you ask on SO, you 
may also get the correct answer, but in addition you will earn SO karma 
points.  Maybe even some neat badge.  I guess it all depends on what 
your goal is.

Obligatory GIL comment -- I wrote some code the other day that used 4 
threads to perform 4 I/O bound operations (fetching 4 jpegs in parallel 
over http).  I figured the fact that they were I/O bound would avoid any 
GIL problems.  I was shocked and dismayed, however, to find that the 4 
operations all got serialized.  I guess I really didn't understand how 
the GIL worked after all.

So, I rewrote it to use the multiprocessing module.  Egads, still 
serialized!  To make a long story short, it turns out we were using some 
crappy consumer-grade Linksys box as our DNS server, and *it* was single 
threaded.  My 4 threads were blocking on name resolution!

We moved to using a real nameserver, and I converted the code back to 
using threading.  Works like a charm now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Replace pip installed package with latest git version?

2011-09-14 Thread Alec Taylor
--editable=git+https://github.com/jedie/python-creole.git is not the right forma
t; it must have #egg=Package

On Wed, Sep 14, 2011 at 10:54 PM, One Murithi o0muri...@gmail.com wrote:
 pip install -e PATH_GIT_CHECKOUT
 On Wed, Sep 14, 2011 at 11:44 AM, Alec Taylor alec.tayl...@gmail.com
 wrote:

 Good evening,

 I've installed a version of python-creole from pip. How do I upgrade
 it to the latest git version?

 (Windows 7 x64 SP1)

 Thanks for all suggestions,

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


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


Re: ImportError: cannot import name dns

2011-09-14 Thread Jack Bates
 It is a circular dependency. Dns will try to import udp which will in turn 
 import dns (again) in an endless cycle; instead an ImportError is raised.

 Circular dependency is a Bad Thing.

According to this documentation:

http://docs.python.org/reference/simple_stmts.html#grammar-token-import_stmt

http://effbot.org/zone/import-confusion.htm

 - I thought Python would do something like:

1. check for dns in sys.modules (initially not found)
2. create new empty module, add it to sys.modules as dns
3. execute dns.py in new module namespace (executes from foo import udp)
4. check for udp in sys.modules (not found)
5. create new empty module, add it to sys.modules as udp
6. execute udp.py in new module namespace (executes from foo import dns)
7. check for dns in sys.modules (found!)
8. done executing udp.py
9. done executing dns.py

So I'd expect attempting to access symbols from dns while executing
udp.py to fail, because dns.py isn't done executing at this point.
However I don't attempt to access any symbols from dns - so I don't
expect this ImportError

What is my mistake?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Replace pip installed package with latest git version?

2011-09-14 Thread Micky Hulse
Hello,

On Wed, Sep 14, 2011 at 1:44 AM, Alec Taylor alec.tayl...@gmail.com wrote:
 I've installed a version of python-creole from pip. How do I upgrade
 it to the latest git version?

Not sure if you got an answer yet, but this is how I would do it:

sudo pip install --upgrade
git+git://github.com/jedie/python-creole.git#egg=python-creole

The sudo may or may not be required.

http://www.pip-installer.org/en/latest/index.html

Hths.

Cheers,
Micky
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Replace pip installed package with latest git version?

2011-09-14 Thread Micky Hulse
On Wed, Sep 14, 2011 at 9:58 AM, Micky Hulse mickyhulse.li...@gmail.com wrote:
 Not sure if you got an answer yet, but this is how I would do it:
 sudo pip install --upgrade
 git+git://github.com/jedie/python-creole.git#egg=python-creole

Having read your message more closely, it sounds like you did not
install the package originally form github? If that's the case, I
don't think using --upgrade will be of any help. Sorry 'bout that.

I suppose you would have to uninstall the original PIP version:

sudo pip uninstall egg-name.egg (or just the package name)

... and then:

sudo pip install -e
git+git://github.com/jedie/python-creole.git#egg=python-creole

Although, I am not sure if that is the best way to do it.

Crawling back into my hole now. :)

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


Re: Replace pip installed package with latest git version?

2011-09-14 Thread Alec Taylor
Thanks, uninstalling first worked.

:D

On Thu, Sep 15, 2011 at 3:06 AM, Micky Hulse mickyhulse.li...@gmail.com wrote:
 On Wed, Sep 14, 2011 at 9:58 AM, Micky Hulse mickyhulse.li...@gmail.com 
 wrote:
 Not sure if you got an answer yet, but this is how I would do it:
 sudo pip install --upgrade
 git+git://github.com/jedie/python-creole.git#egg=python-creole

 Having read your message more closely, it sounds like you did not
 install the package originally form github? If that's the case, I
 don't think using --upgrade will be of any help. Sorry 'bout that.

 I suppose you would have to uninstall the original PIP version:

 sudo pip uninstall egg-name.egg (or just the package name)

 ... and then:

 sudo pip install -e
 git+git://github.com/jedie/python-creole.git#egg=python-creole

 Although, I am not sure if that is the best way to do it.

 Crawling back into my hole now. :)

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

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


Re: ANN: PyGUI 2.5

2011-09-14 Thread Bill Janssen
Gregory Ewing greg.ew...@canterbury.ac.nz wrote:

 Terry Reedy wrote:
 
  Greg left out the most important to me:
  Now works with Python 3 on MacOSX and Windows!
 
 I'm not making too much of that at the moment, because it
 *doesn't* work on Linux yet, and I've no idea how long
 it will be before it does.
 
 The issue is that there will apparently not be any
 Python 3 version of pygtk, on the grounds that gobject
 introspection can be used instead. Unfortunately,
 Gtk 3 and related libraries don't quite handle gobject
 introspection well enough to support PyGUI at the moment.

One possibility would be to develop a PyGUI branch on top of Tk, so that
it would work with Python anywhere.

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


Re: stackoverflow and c.l.py (was: GIL switch interval)

2011-09-14 Thread Duncan Booth
Roy Smith r...@panix.com wrote:

 In article Xns9F605E618E6B1duncanbooth@127.0.0.1,
  Duncan Booth duncan.booth@invalid.invalid wrote:
 
 If you want an answer to how to get a specific bit of code to work then 
 Stackoverflow is better if only because people can see who has already 
 answered so don't need to waste time re-answering every trivial little 
 question about syntax.
 
 Any halfway decent newsreader application will follow threading and put 
 all the responses to a given question in one place.  Of course, this is 
 a relatively new feature.  If your newsreader is any older than about 
 the mid 1980's, it may not be able to do this.
 
Sorry, I evidently didn't make myself clear. On Usenet it could be hours 
before your local server updates with other posts on the thread, on 
Stackoverflow the answers will update live as they are posted.

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


Re: stackoverflow and c.l.py

2011-09-14 Thread Thomas Jollans
On 14/09/11 21:00, Duncan Booth wrote:
 Roy Smith r...@panix.com wrote:
 
 In article Xns9F605E618E6B1duncanbooth@127.0.0.1,
  Duncan Booth duncan.booth@invalid.invalid wrote:

 If you want an answer to how to get a specific bit of code to work then 
 Stackoverflow is better if only because people can see who has already 
 answered so don't need to waste time re-answering every trivial little 
 question about syntax.

 Any halfway decent newsreader application will follow threading and put 
 all the responses to a given question in one place.  Of course, this is 
 a relatively new feature.  If your newsreader is any older than about 
 the mid 1980's, it may not be able to do this.

 Sorry, I evidently didn't make myself clear. On Usenet it could be hours 
 before your local server updates with other posts on the thread, on 
 Stackoverflow the answers will update live as they are posted.

The mailing list python-list, however, doesn't have this problem.
(unless when people post from slow USENET servers of course...)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2011-09-14 Thread Arnaud Delobelle
On 14 September 2011 11:03, Vincent Vande Vyvre
vincent.vandevy...@swing.be wrote:
 Le 14/09/11 11:31, Arnaud Delobelle a écrit :
[...]
 Could you show me what you do to get this error?  Thank you,

 [vincent@myhost unpyc3]$ python
 Python 3.2.1 (default, Jul 11 2011, 12:37:47)
 [GCC 4.6.1] on linux2
 Type help, copyright, credits or license for more information.
 from unpyc3 import decompile
 print (decompile(shredder.pyc))
 Traceback (most recent call last):
   File stdin, line 1, in module
   File unpyc3.py, line 110, in decompile
     return dec_module(obj)
   File unpyc3.py, line 99, in dec_module
     code = Code(code_obj)
   File unpyc3.py, line 211, in __init__
     for v in code_obj.co_cellvars + code_obj.co_freevars]
 AttributeError: 'NoneType' object has no attribute 'co_cellvars'
 print (decompile(unpyc3.pyc))
 Traceback (most recent call last):
   File stdin, line 1, in module
   File unpyc3.py, line 110, in decompile
     return dec_module(obj)
   File unpyc3.py, line 99, in dec_module
     code = Code(code_obj)
   File unpyc3.py, line 211, in __init__
     for v in code_obj.co_cellvars + code_obj.co_freevars]
 AttributeError: 'NoneType' object has no attribute 'co_cellvars'
 import os
 os.path.isfile(shredder.pyc)
 True
 os.path.isfile(unpyc3.pyc)
 True


 it seems the return of marshal.load(stream) is None

I think the reason may be that your unpyc3.pyc and shredder.pyc files
were compiled with a different version of python and the read_code
function returns None because the magic number in the .pyc file is
incorrect because of these two lines:

if magic != imp.get_magic():
return None

I have now changed this so that it loads the file anyway but prints a
warning.  I guess this may break badly though.

In Python 3.2, .pyc files are hidden in a __pycache__ directory.  So
the Python 3.2 specific unpyc3.pyc file for example is probably
located at .../unpyc3/__pycache__/unpyc3-cpython-32.pyc

The easiest way to find the path of the .pyc file if you know the path
of the .py file is probably as follows:

 import imp
 imp.cache_from_source(unpyc3.py)
'__pycache__/unpyc3.cpython-32.pyc'

Here's an example decompiling the dis module from the standard library:

 import dis
 dis.__file__
'/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/dis.py'
 imp.cache_from_source(dis.__file__)
'/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/__pycache__/dis.cpython-32.pyc'
 print(decompile(_))
__doc__ = 'Disassembler of Python byte code into mnemonics.'
import sys
import types
from opcode import *
from opcode import __all__ as _opcodes_all
__all__ = ['code_info', 'dis', 'disassemble', 'distb', 'disco',
'findlinestarts', 'findlabels', 'show_code'] + _opcodes_all
del _opcodes_all
_have_code = types.MethodType, types.FunctionType, types.CodeType, type
def _try_compile(source, name):
try:
c = compile(source, name, 'eval')
except SyntaxError:
c = compile(source, name, 'exec')
return c
[... many more lines ...]

I hope this will work for you,

-- 
Arnaud

PS: I've also added support for the IMPORT_STAR opcode which I had overlooked.
-- 
http://mail.python.org/mailman/listinfo/python-list


Reconciling os.path.getmtime vs ftp.sendcmd('MDTM filename')

2011-09-14 Thread Tim Johnson
I have written a class that uses ftplib.FTP as the parent.
I need to reconcile the modified time of a workstation file with
that same filename on a remote server.
Let's say we have a file called '400.shtml'. I get the mtime on
my workstation by
 os.path.getmtime('400.shtml')
1311648420.0
And I use 
 ftp.sendcmd('MDTM 400.shtml') ## for the remote server
'213 20110726004703'

My question is how to compare the two outputs?
Pointers to documentation and other resources are invited.

thanks
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


libxml2dom quesiton

2011-09-14 Thread bruce
Hi.

Test question. Trying to see how to insert a test node into an
existing dom tree. For the test, it has a TR/TD with a
td[@class=foo] that has an associated TR..

Trying to figure out how out how to insert a DIV/DIV around the
tr/td in question...

Curious as to how to accomplish this.

Thoughts/pointers.

thanks



--
sample code/html chunk follows:

import libxml2dom

  text is below

tt = libxml2dom.parseString(text, html=1)
t1path_=tt.xpath(t1path)

aa=tt.createElement(div)
print len(t1path_)
for a in t1path_:

  tt.insertBefore(aa,None)
  print a.nodeName
  print a.toString()

sys.exit()



s3==
html
body
tr
td class=foo
/td
/tr
tr
td
/td
/tr
tr
td class=foo
/td
/tr
/body
/html


trying to get::
html
body
div
tr
td class=foo
/td
/tr
/div
tr
td
/td
/tr
div
tr
td class=foo
/td
/tr
/div
/body
/html
-- 
http://mail.python.org/mailman/listinfo/python-list


Accessing matplotlib-users discussion group?

2011-09-14 Thread John Ladasky
Hi folks,

Apologies if this is a bit off-topic, but there must be another
Pythoneer out there who can help me navigate my current problem.

I'm working with matplotlib, the Python graphing package.  I need to
ask some questions about it, and the place to ask those questions
would appear to be the matplotlib-users discussion group.  Matplotlib-
users appears to be hosted on sourceforge.net (and is not mirrored
anywhere else?), so I tried to sign up for an account (at
https://sourceforge.net/user/registration).

Yesterday, after filling out the registration page, Sourceforge
rejected my registration, without any notice that I observed.  Today,
I tried that registration again.  This time, on the upper right corner
of the rejection page, I saw the following message: your registration
violated our anti-spam filter.

WTF?

I tried searching Sourceforge for information on what their anti-spam
filter is, and how my registration could possibly have violated it.  I
found nothing.

If anyone out there can tell me how 1) I can actually register with
Sourceforge, or 2) how I might post to matplotlib-users without
bothering with Sourceforge, I would be most grateful!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stackoverflow and c.l.py

2011-09-14 Thread Westley Martínez
On Wed, Sep 14, 2011 at 10:47:15PM +1000, Chris Angelico wrote:
 On Wed, Sep 14, 2011 at 10:33 PM, memilanuk memila...@gmail.com wrote:
  Not saying one is necessarily better than the other, but just subscribing to
  the feed for the [python] tag on SO has a pretty good SNR...
 
 The SNR here isn't bad either. Most of the spam gets filtered out, and
 even stuff like Ranting Rick posts can be of some amusement when it's
 a slow day...
 
 ChrisA

And IMO the quality of [Python] code here is better than at SO.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stackoverflow and c.l.py

2011-09-14 Thread Westley Martínez
On Wed, Sep 14, 2011 at 06:05:23AM -0700, memilanuk wrote:
 On 09/14/2011 05:47 AM, Chris Angelico wrote:
 The SNR here isn't bad either. Most of the spam gets filtered out, and
 even stuff like Ranting Rick posts can be of some amusement when it's
 a slow day...
 
 I subscribe to the list via Gmane, and if 'most of the spam' gets
 filtered out, I'd hate to see how much gets submitted as I still see
 2-5 minimum blatant spam per day on here.
 
 Rick  Xang Li are two examples of what you *don't* see (or at least
 I don't) @ SO


I don't understand the matter of spam and trolls.  You can just delete
it if you don't want it.  It's not like we're getting thousands per day.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stackoverflow and c.l.py

2011-09-14 Thread Rhodri James

On Wed, 14 Sep 2011 14:05:23 +0100, memilanuk memila...@gmail.com wrote:

Rick  Xang Li are two examples of what you *don't* see (or at least I  
don't) @ SO


Then you haven't been looking hard enough ;-)

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: stackoverflow and c.l.py

2011-09-14 Thread Steven D'Aprano
memilanuk wrote:

 On 09/14/2011 05:47 AM, Chris Angelico wrote:
 The SNR here isn't bad either. Most of the spam gets filtered out, and
 even stuff like Ranting Rick posts can be of some amusement when it's
 a slow day...
 
 I subscribe to the list via Gmane, and if 'most of the spam' gets
 filtered out, I'd hate to see how much gets submitted as I still see 2-5
 minimum blatant spam per day on here.

2-5 spam posts is nothing. (Well, I know any spam is too much spam, but
still.) Since nearly all of it is obvious, it's easy to filter out of your
mail client, news client, or if all else fails, your attention. The hard
ones to ignore are the ones that look like they might be legitimate, but
fortunately most spammers are too lazy or stupid to bother with even the
most feeble disguise.

Either way, I don't consider half a dozen spam posts a day to be anything
more than a minor distraction.

Commercial spam is annoying, but otherwise harmless because it is so easy to
filter. What's really the problem is crackpots, trollers and griefers,
because there is a terrible temptation to engage them in debate: someone
is wrong on the Internet!. If you want to see a news group gone bad, go to
something like sci.math. You can't move for the cranks disproving
Cantor's Diagonal Theorem and Special Relativity and proving that 10**603
is the One True Actual Infinity (I'm not making that last one up!).



-- 
Steven

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


Re: Reconciling os.path.getmtime vs ftp.sendcmd('MDTM filename')

2011-09-14 Thread Chris Rebert
On Wed, Sep 14, 2011 at 12:50 PM, Tim Johnson t...@akwebsoft.com wrote:
 I have written a class that uses ftplib.FTP as the parent.
 I need to reconcile the modified time of a workstation file with
 that same filename on a remote server.
 Let's say we have a file called '400.shtml'. I get the mtime on
 my workstation by
 os.path.getmtime('400.shtml')
 1311648420.0

http://docs.python.org/library/os.path.html#os.path.getmtime
Your sample seems to be a typical Unix timestamp:
http://en.wikipedia.org/wiki/Unix_time

 And I use
 ftp.sendcmd('MDTM 400.shtml') ## for the remote server
 '213 20110726004703'

RFC 3659 - Extensions to FTP
Sec 3. File Modification Time (MDTM)
http://tools.ietf.org/html/rfc3659#section-3

(Note: Code 213 = File status response)

 My question is how to compare the two outputs?
 Pointers to documentation and other resources are invited.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


A documents editor in Firefox with Python Sphinx tool

2011-09-14 Thread 文山 杜
Baow is a tool that makes it easy to organize your internet resources
and create intelligent and beautiful web pages within Firefox web
browser.

Highlights :

 * Tree based outline, help you organize internet resources and
documents.
 * Save or bookmark web images, files or pages.
 * Multi level project management.
 * Full text search.
 * Generate web pages by Python Sphinx tools,
http://sphinx.pocoo.org . Lots of quick menus help you write and
preview
Python Sphinx and reStructuredText markup documents.
 * Multi platform support, Windows, Linux, Mac, etc.

Home page:  https://addons.mozilla.org/en-US/firefox/addon/baow/
-- 
http://mail.python.org/mailman/listinfo/python-list


help regarding re.search

2011-09-14 Thread Sagar Neve
Hi,
I have a small program where I want to do just a small regex operation.
I want to see if value of a variable 'A' is present in an another variable
'B'.  The below code works fine but as soon as the variable 'A' has some
string including a dot it fails.

for example say:
B=dpkg.ipaz
The code works fine  when A=dpkg
however the code does not work when A=dpkg.ipa

if re.search(A,B):
  # do something.

Can somebody please help me ?
-- 
http://mail.python.org/mailman/listinfo/python-list


help regarding re.search

2011-09-14 Thread Sagar Neve
Hi,
I have a small program where I want to do just a small regex operation.
I want to see if value of a variable 'A' is present in an another variable
'B'.  The below code works fine but as soon as the variable 'A' has some
string including a dot it fails.

for example say:
B=dpkg.ipaz
The code works fine  when A=dpkg
however the code does not work when A=dpkg.ipa

if re.search(A,B):
  # do something.

Can somebody please help me ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help regarding re.search

2011-09-14 Thread Chris Rebert
On Wed, Sep 14, 2011 at 6:41 PM, Sagar Neve nevesa...@gmail.com wrote:
 Hi,
 I have a small program where I want to do just a small regex operation.
 I want to see if value of a variable 'A' is present in an another variable
 'B'.  The below code works fine but as soon as the variable 'A' has some
 string including a dot it fails.

There's no need to use regexes at all! Just do:
if A in B:
# do something

 for example say:
 B=dpkg.ipaz
 The code works fine  when A=dpkg
 however the code does not work when A=dpkg.ipa

Right, because period is a regex metacharacter. To have it treated as
a literal character to match, escape it:
http://docs.python.org/library/re.html#re.escape

Cheers,
Chris
--
http://rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with Dos command by python script

2011-09-14 Thread Chris Rebert
On Wed, Sep 14, 2011 at 1:13 PM, Jonatas Emidio jonatasemi...@gmail.com wrote:
 Here i come!!

 I have the following problem...
 I need run by python script a string with some DOS commands - Windows
 prompt!!
 For exemple:
 print 'cd temp'
 print 'mkdir temp_app'

 How can i run this string in the python, but as a DOS interpreter?

Use the `subprocess` module, and pass shell=True.
http://docs.python.org/library/subprocess.html

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reconciling os.path.getmtime vs ftp.sendcmd('MDTM filename')

2011-09-14 Thread Tim Johnson
* Chris Rebert c...@rebertia.com [110914 16:46]:
 On Wed, Sep 14, 2011 at 12:50 PM, Tim Johnson t...@akwebsoft.com wrote:
  I have written a class that uses ftplib.FTP as the parent.
  I need to reconcile the modified time of a workstation file with
  that same filename on a remote server.
  Let's say we have a file called '400.shtml'. I get the mtime on
  my workstation by
  os.path.getmtime('400.shtml')
  1311648420.0
 
 http://docs.python.org/library/os.path.html#os.path.getmtime
 Your sample seems to be a typical Unix timestamp:
 Yup. Needs to be converted to a timedate stamp, methinks.
 http://en.wikipedia.org/wiki/Unix_time
  I'll look at that tomorrow. Late here.  
  And I use
  ftp.sendcmd('MDTM 400.shtml') ## for the remote server
  '213 20110726004703'
 
 RFC 3659 - Extensions to FTP
 Sec 3. File Modification Time (MDTM)
 http://tools.ietf.org/html/rfc3659#section-3
 
 (Note: Code 213 = File status response)
  and '213 20110726004703'[4:] should give me
  the string representation of the timedate stamp on the
  remote file.

  Thanks. I will look at the unix_time entry soon.

-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Offer Red Bull Hats superior in quality and price is favourable on http://www.mlbhatshop.com/

2011-09-14 Thread zhenzhen zhang
MLBHatShop with Original Red Bull Hats, New Era Hats, Monster Energy
Hats, Red Bull Beanies, DC Hats, Red Bull New Era Hats, Monster
Beanies Sales Promotion. Door to Door Free Shipping. http://www.mlbhatshop.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help regarding re.search

2011-09-14 Thread Sagar Neve
If A in B:
does nt seem to be working.
Am I missing something here.

-$agar
On Sep 15, 2011 7:25 AM, Chris Rebert c...@rebertia.com wrote:
 On Wed, Sep 14, 2011 at 6:41 PM, Sagar Neve nevesa...@gmail.com wrote:
 Hi,
 I have a small program where I want to do just a small regex operation.
 I want to see if value of a variable 'A' is present in an another
variable
 'B'.  The below code works fine but as soon as the variable 'A' has some
 string including a dot it fails.

 There's no need to use regexes at all! Just do:
 if A in B:
 # do something

 for example say:
 B=dpkg.ipaz
 The code works fine  when A=dpkg
 however the code does not work when A=dpkg.ipa

 Right, because period is a regex metacharacter. To have it treated as
 a literal character to match, escape it:
 http://docs.python.org/library/re.html#re.escape

 Cheers,
 Chris
 --
 http://rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help regarding re.search

2011-09-14 Thread Chris Rebert
On Wed, Sep 14, 2011 at 8:33 PM, Sagar Neve nevesa...@gmail.com wrote:
 If A in B:
 does nt seem to be working.
 Am I missing something here.

Please provide a snippet of the code in question, and be specific
about how it's not working.

Cheers,
Chris
--
http://rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: PyGUI 2.5

2011-09-14 Thread Greg Ewing

On 15/09/11 06:47, Bill Janssen wrote:


One possibility would be to develop a PyGUI branch on top of Tk, so that
it would work with Python anywhere.


Unfortunately, I doubt whether Tk would be up to the task of
supporting PyGUI efficiently. The philosophies of model-view
separation and allowing more than one view of a model are at
odds with the way Tk works.

Anyone who wants to have a go at it is welcome to try,
though.

--
Greg

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


Re: help regarding re.search

2011-09-14 Thread Sagar Neve
Here is the code


url=http://xy.yz.com/us/r1000/012/Purple/b1/c6/e2/mzm.dxkjsfbl..d2.dpkg.ipa


Man_Param=/us/r1000
Opt_Param1=Purple
Opt_Param2=dpkg.ipa

if (Opt_Param2 in url):
print hello.
else:
print bye.

It  gives me:

./sample.py: line 9: syntax error near unexpected token `:'
./sample.py: line 9: `if (Opt_Param2 in url):'


Help.


On Thu, Sep 15, 2011 at 9:05 AM, Chris Rebert c...@rebertia.com wrote:

 On Wed, Sep 14, 2011 at 8:33 PM, Sagar Neve nevesa...@gmail.com wrote:
  If A in B:
  does nt seem to be working.
  Am I missing something here.

 Please provide a snippet of the code in question, and be specific
 about how it's not working.

 Cheers,
 Chris
 --
 http://rebertia.com

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


Re: help regarding re.search

2011-09-14 Thread Chris Angelico
On Thu, Sep 15, 2011 at 2:41 PM, Sagar Neve nevesa...@gmail.com wrote:
 ./sample.py: line 9: syntax error near unexpected token `:'
 ./sample.py: line 9: `if (Opt_Param2 in url):    '


It worked for me in Python 3.2. What version of Python are you using?

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


Re: help regarding re.search

2011-09-14 Thread Sagar Neve
I figured it out with the sample program I gave you.   It was my mistake;
However, the same thing with same values is not working in my main program.

Here is what I am trying: The program traverses with correct values upto the
if condition we just discussed; but fails to quality that if condition;
instead it should qualify.


for key in dictionary:
m=re.search(key, url)
if m !=None:
values=dictionary[key]
for v in values:
v_array=v.split(',')
Man_Param=v_array[4]
Opt_Param1=v_array[5]
Opt_Param2=v_array[6]
Cat=v_array[1]
Man_Param=re.sub(r'(?Pdn.*?)','\gdn', Man_Param)
Opt_Param1=re.sub(r'(?Pdn.*?)','\gdn', Opt_Param1)
Opt_Param2=re.sub(r'(?Pdn.*?)','\gdn', Opt_Param2)
Cat=re.sub(r'(?Pdn.*?)','\gdn', Cat)
Cat=re.sub(r':','_', Cat)
Cat=re.sub(r' ','_', Cat)
print hello..Man_Param=%s,Opt_Param1=%s,
Opt_Param2=%s\n %(Man_Param,Opt_Param1,Opt_Param2)
#sys.exit(1)
if len(Opt_Param1):
if len(Opt_Param2):
#if (re.search(Man_Param,url) and
re.search(Opt_Param1,url) and re.search(Opt_Param2,url) ):
print url
   * if (Man_Param in url):#and (Opt_Param1 in url)
and (Opt_Param2 in url):*
print all are found..\n
sys.exit(1)
if((int(cl)  5000 or int(rc) == 206) and
re.match(rAS_D,Cat) ):
Cat= Cat + _cont
foutname = output + / + Cat +. +
str(cnt)
fout =open(foutname, a)
fout.write(line)
fout.close
else:
print here\n;
sys.exit(1)




On Thu, Sep 15, 2011 at 10:19 AM, Chris Angelico ros...@gmail.com wrote:

 On Thu, Sep 15, 2011 at 2:41 PM, Sagar Neve nevesa...@gmail.com wrote:
  ./sample.py: line 9: syntax error near unexpected token `:'
  ./sample.py: line 9: `if (Opt_Param2 in url):'
 

 It worked for me in Python 3.2. What version of Python are you using?

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

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


Re: help regarding re.search

2011-09-14 Thread Kushal Kumaran
On Thu, Sep 15, 2011 at 10:11 AM, Sagar Neve nevesa...@gmail.com wrote:
 Here is the code


 url=http://xy.yz.com/us/r1000/012/Purple/b1/c6/e2/mzm.dxkjsfbl..d2.dpkg.ipa;

 Man_Param=/us/r1000
 Opt_Param1=Purple
 Opt_Param2=dpkg.ipa

 if (Opt_Param2 in url):
     print hello.
 else:
     print bye.

 It  gives me:

 ./sample.py: line 9: syntax error near unexpected token `:'
 ./sample.py: line 9: `if (Opt_Param2 in url):    '



That looks like a bash error message.  Syntax errors in python show up
with a stack trace.  Run your program using the python interpreter
like this:

python file.py
OR
python3 file.py

whatever is applicable in your environment.



 On Thu, Sep 15, 2011 at 9:05 AM, Chris Rebert c...@rebertia.com wrote:

 On Wed, Sep 14, 2011 at 8:33 PM, Sagar Neve nevesa...@gmail.com wrote:
  If A in B:
  does nt seem to be working.
  Am I missing something here.

 Please provide a snippet of the code in question, and be specific
 about how it's not working.


-- 
regards,
kushal
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help regarding re.search

2011-09-14 Thread Chris Angelico
On Thu, Sep 15, 2011 at 2:55 PM, Kushal Kumaran
kushal.kumaran+pyt...@gmail.com wrote:
 That looks like a bash error message.  Syntax errors in python show up
 with a stack trace.  Run your program using the python interpreter
 like this:

 python file.py
 OR
 python3 file.py

 whatever is applicable in your environment.


Or add a shebang to the top of your script.

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


Re: help regarding re.search

2011-09-14 Thread Sagar Neve
Yes. It is been resolved now for the sample program. however, as mentioned
in other post. It is not working in the main program


On Thu, Sep 15, 2011 at 10:25 AM, Kushal Kumaran 
kushal.kumaran+pyt...@gmail.com wrote:

 On Thu, Sep 15, 2011 at 10:11 AM, Sagar Neve nevesa...@gmail.com wrote:
  Here is the code
 
 
  url=
 http://xy.yz.com/us/r1000/012/Purple/b1/c6/e2/mzm.dxkjsfbl..d2.dpkg.ipa;
 
  Man_Param=/us/r1000
  Opt_Param1=Purple
  Opt_Param2=dpkg.ipa
 
  if (Opt_Param2 in url):
  print hello.
  else:
  print bye.
 
  It  gives me:
 
  ./sample.py: line 9: syntax error near unexpected token `:'
  ./sample.py: line 9: `if (Opt_Param2 in url):'
 
 

 That looks like a bash error message.  Syntax errors in python show up
 with a stack trace.  Run your program using the python interpreter
 like this:

 python file.py
 OR
 python3 file.py

 whatever is applicable in your environment.

 
 
  On Thu, Sep 15, 2011 at 9:05 AM, Chris Rebert c...@rebertia.com wrote:
 
  On Wed, Sep 14, 2011 at 8:33 PM, Sagar Neve nevesa...@gmail.com
 wrote:
   If A in B:
   does nt seem to be working.
   Am I missing something here.
 
  Please provide a snippet of the code in question, and be specific
  about how it's not working.
 

 --
 regards,
 kushal

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


Cancel or timeout a long running regular expression

2011-09-14 Thread python
Is there a way to cancel or timeout a long running regular
expression?

I have a program that accepts regular expressions from users and
I'm concerned about how to handle worst case regular expressions
that seem to run forever. Ideally I'm looking for a way to
evaluate a regular expression and timeout after a specified time
period if the regular expression hasn't completed yet. Or a way
for a user to cancel a long running regular expression.

I was thinking there might be a technique I could use to evaluate
regular expressions in a thread or another process launched via
multiprocessing module and then kill the thread/process after a
specified timeout period. My concern about the multiprocessing
module technique is that launching a process for every regex
evaluation sounds pretty inefficient. And I don't think the
threading module supports the ability to kill threads from
outside a thread itself.

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


cause __init__ to return a different class?

2011-09-14 Thread Matthew Pounsett
I'm wondering if there's a way in python to cause __init__ to return a class 
other than the one initially specified.  My use case is that I'd like to have a 
superclass that's capable of generating an instance of a random subclass.  

I've tried both returning the subclass (as I would when overloading an 
operator) but I get the complaint that __init__ wants to return None instead of 
a type.

The other thing I tried was overwriting 'self' while inside __init__ but that 
doesn't seem to work either.

class Parent(object):
def __init__(self, foo):
if foo == True:
self = Child(foo)

class Child(Parent):
def __init__(self, foo):
pass

Is there a way to do this?  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with Dos command by python script

2011-09-14 Thread Gadget/Steve
On 14/09/2011 9:13 PM, Jonatas Emidio wrote:
 Here i come!!

 I have the following problem...
 I need run by python script a string with some DOS commands - Windows
 prompt!!
 For exemple:
 print 'cd temp'
 print 'mkdir temp_app'

 How can i run this string in the python, but as a DOS interpreter?
The direct answer to your question is to tell you to take a look at the
subprocess module documentation but if the above is what you would like
to do then take a look as os.chdir(), os.mkdir(), os.mkdirs() and then
do the above in python.


I would also suggest that you should raise this sort of question at
Gadget/Steve

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


Re: cause __init__ to return a different class?

2011-09-14 Thread Chris Rebert
On Wed, Sep 14, 2011 at 10:20 PM, Matthew Pounsett
matt.pouns...@gmail.com wrote:
 I'm wondering if there's a way in python to cause __init__ to return a class 
 other than the one initially specified.  My use case is that I'd like to have 
 a superclass that's capable of generating an instance of a random subclass.
snip
 Is there a way to do this?

Override __new__() instead:
http://docs.python.org/reference/datamodel.html#object.__new__

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cause __init__ to return a different class?

2011-09-14 Thread Ryan Kelly
On 15/09/11 15:35, Chris Rebert wrote:
 On Wed, Sep 14, 2011 at 10:20 PM, Matthew Pounsett
 matt.pouns...@gmail.com wrote:
 I'm wondering if there's a way in python to cause __init__ to return a class 
 other than the one initially specified.  My use case is that I'd like to 
 have a superclass that's capable of generating an instance of a random 
 subclass.
 snip
 Is there a way to do this?
 
 Override __new__() instead:
 http://docs.python.org/reference/datamodel.html#object.__new__


The above will do exactly what you want, but it's generally bad style
unless you have a very specific use-case.  Is there a particular reason
you need to magically return a subclass, rather than making this
explicit in the code?

To be friendlier to others reading your code, I would consider using a
classmethod to create an alternative constructor:


   class MyBaseClass(object):

@classmethod
def get_random_subclass(cls, *args, **kwds)
subcls = random.choice(cls.__subclasses__())
return subcls(*args, **kwds)


To me, this reads pretty cleanly and makes it obvious that something
unusual is going on:

obj = MyBaseClass.get_random_subclass()

While this hides the intention of the code and would require additional
documentation or comments:

obj = MyBaseClass()  # note: actually returns a subclass!



Just a thought :-)


  Cheers,

Ryan


-- 
Ryan Kelly
http://www.rfk.id.au  |  This message is digitally signed. Please visit
r...@rfk.id.au|  http://www.rfk.id.au/ramblings/gpg/ for details





signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue12970] os.walk() consider some symlinks as dirs instead of non-dirs

2011-09-14 Thread Alexey Smirnov

Changes by Alexey Smirnov alexey.smir...@gmx.com:


--
nosy: +alexey-smirnov

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



[issue12971] os.isdir() should contain skiplinks=False in arguments

2011-09-14 Thread Alexey Smirnov

Changes by Alexey Smirnov alexey.smir...@gmx.com:


--
nosy: +alexey-smirnov

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



[issue12975] Invitation to connect on LinkedIn

2011-09-14 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


--
resolution:  - invalid
status: open - closed

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



[issue12975] Invitation to connect on LinkedIn

2011-09-14 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Removed file: http://bugs.python.org/file23150/unnamed

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



[issue12975] Invitation to connect on LinkedIn

2011-09-14 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
Removed message: http://bugs.python.org/msg144010

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



[issue12975] spam

2011-09-14 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage:  - committed/rejected
title: Invitation to connect on LinkedIn - spam

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



[issue8828] Atomic function to rename a file

2011-09-14 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 According to the following article, a fsync is also needed on the 
 directory after a rename. I don't understand if is it always needed for 
 an atomic rename, or if we only need it for the atomic write pattern.

It's not needed if you just want atomicity, i.e. the file is visible either 
under its old name or its new name, but not neither or both.
If is however needed if you want durability, i.e. you want to guarantee that 
the file is visible under its new name after your atomic_rename returns.

--
nosy: +neologix

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



[issue11149] [PATCH] Configure should enable -fwrapv for clang

2011-09-14 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 2**64
0

Urk!  I'd call that a release blocker.

--

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



[issue12973] int_pow() implementation is incorrect

2011-09-14 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Reopening and assigning to me;  it would be good to fix this in intobject.c as 
well as adding the Clang-specific -fwrapv fix.

--
assignee:  - mark.dickinson
nosy: +mark.dickinson
status: closed - open

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



[issue12960] threading.Condition is not a class

2011-09-14 Thread STINNER Victor

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

 Yes, but further down it still says:

 
 class threading.Condition([lock])

  If the lock argument is given and not None, []
 

What do you suggest? Replace it by class threading._Condition?

--

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



[issue12386] packaging fails in install_distinfo when writing RESOURCES

2011-09-14 Thread Vinay Sajip

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

I looked at this bug again - I was getting a little confused about it ;-) The 
problem is happening not when writing out a resource, but the RESOURCES file 
listing the resources installed. This is a text file, of course, so my 
suggested fix of using open(resources_path, 'w', encoding='utf-8') would be 
reasonable.

--

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



[issue9871] IDLE dies when using some regex

2011-09-14 Thread Popa Claudiu

Popa Claudiu pcmantic...@gmail.com added the comment:

Hello. This happens with this version of IDLE too: 

Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on 
win32. 
I could write a patch if I knew where to start.

--

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



[issue12973] int_pow() implementation is incorrect

2011-09-14 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Notice that this signed overflow issue is also tracked as #1621. I don't mind 
keeping this issue open, though - it's unlikely that #1621 will be fixed within 
this decade. unless somebody does some heroic effort.

--
nosy: +loewis

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



[issue12960] threading.Condition is not a class

2011-09-14 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

 What do you suggest? Replace it by class threading._Condition?

-1 on this

IMHO just documenting the situation as it is would make more sense

--
nosy: +eli.bendersky

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



[issue9871] IDLE dies when using some regex

2011-09-14 Thread Popa Claudiu

Popa Claudiu pcmantic...@gmail.com added the comment:

I found the culprit. I wrote b\x in IDLE and the window immediatly 
disappeared. Then, to traceback the problem, I started a python shell and typed 
the following lines. It seems that in showsyntaxerror, value is different that 
what was expected. 

C:\python
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import idlelib.PyShell
 idlelib.PyShell.main()
Exception in Tkinter callback
Traceback (most recent call last):
  File C:\Python32\lib\code.py, line 63, in runsource
code = self.compile(source, filename, symbol)
  File C:\Python32\lib\codeop.py, line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
  File C:\Python32\lib\codeop.py, line 82, in _maybe_compile
code = compiler(source, filename, symbol)
  File C:\Python32\lib\codeop.py, line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
ValueError: invalid \x escape

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File C:\Python32\lib\tkinter\__init__.py, line 1399, in __call__
return self.func(*args)
  File C:\Python32\lib\idlelib\MultiCall.py, line 166, in handler
r = l[i](event)
  File C:\Python32\lib\idlelib\PyShell.py, line 1126, in enter_callback
self.runit()
  File C:\Python32\lib\idlelib\PyShell.py, line 1167, in runit
more = self.interp.runsource(line)
  File C:\Python32\lib\idlelib\PyShell.py, line 617, in runsource
return InteractiveInterpreter.runsource(self, source, filename)
  File C:\Python32\lib\code.py, line 66, in runsource
self.showsyntaxerror(filename)
  File C:\Python32\lib\idlelib\PyShell.py, line 654, in showsyntaxerror
msg = value.msg or no detail available
AttributeError: 'ValueError' object has no attribute 'msg'


--

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



[issue9871] IDLE dies when using some regex

2011-09-14 Thread Popa Claudiu

Popa Claudiu pcmantic...@gmail.com added the comment:

I've attached a patch, hope it is ok.

--
keywords: +patch
Added file: http://bugs.python.org/file23151/idle.patch

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




[issue9871] IDLE dies when using some regex

2011-09-14 Thread Popa Claudiu

Changes by Popa Claudiu pcmantic...@gmail.com:


Removed file: http://bugs.python.org/file23151/idle.patch

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



[issue9871] IDLE dies when using some regex

2011-09-14 Thread Popa Claudiu

Popa Claudiu pcmantic...@gmail.com added the comment:

Wrong patch.

--

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



[issue9871] IDLE dies when using some regex

2011-09-14 Thread Popa Claudiu

Changes by Popa Claudiu pcmantic...@gmail.com:


Added file: http://bugs.python.org/file23152/idle.patch

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



[issue12976] select module: only use EVFILT_TIMER if available (kqueue backend)

2011-09-14 Thread Benny Siegert

New submission from Benny Siegert bsieg...@gmail.com:

When building python-2.6 on MirBSD, building the select module (which uses the 
kqueue backend on this platform) fails. This is because EVFILT_TIMER is not 
available on the platform.

The proposed patch is for python-2.6 but should apply to tip too.

This was discovered when building the python package from NetBSD pkgsrc, so the 
patch is taken from there.

--
components: Extension Modules
files: patch-az
messages: 144022
nosy: bsiegert
priority: normal
severity: normal
status: open
title: select module: only use EVFILT_TIMER if available (kqueue backend)
type: compile error
versions: Python 2.6
Added file: http://bugs.python.org/file23153/patch-az

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



[issue12960] threading.Condition is not a class

2011-09-14 Thread Nikolaus Rath

Nikolaus Rath nikol...@rath.org added the comment:

On 09/14/2011 04:29 AM, STINNER Victor wrote:
 
 STINNER Victor victor.stin...@haypocalc.com added the comment:
 
 Yes, but further down it still says:

 
 class threading.Condition([lock])

  If the lock argument is given and not None, []
 
 
 What do you suggest? Replace it by class threading._Condition?

I don't have an optimal solution that would fit into the prescribed
layout. I think the best we can do is keep calling it class threading
Condition, but mention in the very first sentence that it isn't actually
a class:

class threading.Condition([lock]):

threading.Condition is not actually a class but a factory function.
The returned instance, however, is guaranteed to have the behaviour
of a threading.Condition class as described here.

If the lock argument...

Best,

   -Nikolaus

--

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



[issue12977] socket.socket.setblocking does not raise exception if no data available

2011-09-14 Thread Florian Ludwig

New submission from Florian Ludwig flor...@leijuna.de:

The documentation states:

 In non-blocking mode, if a recv() call doesn’t find any data, [...], a error 
 exception is raised; [0]

Which is wrong. If no data is available recv() does not raise an exception but 
returns an empty string.

[0] http://docs.python.org/library/socket.html#socket.socket.setblocking

--
assignee: docs@python
components: Documentation
messages: 144024
nosy: Florian.Ludwig, docs@python
priority: normal
severity: normal
status: open
title: socket.socket.setblocking does not raise exception if no data available
versions: Python 2.7

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



[issue11149] [PATCH] Configure should enable -fwrapv for clang

2011-09-14 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

 Does the test suite catch this bug?

I think all of those fail due to the bug in pow():

20 tests failed:
test_array test_builtin test_bytes test_decimal test_float
test_fractions test_getargs2 test_index test_int test_itertools
test_list test_long test_long_future test_math test_random test_re
test_strtod test_tokenize test_types test_xrange

--

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



[issue11149] [PATCH] Configure should enable -fwrapv for clang

2011-09-14 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 0f1e8c246a7b by Stefan Krah in branch '3.2':
Issue #11149: recent versions of clang require the -fwrapv flag.
http://hg.python.org/cpython/rev/0f1e8c246a7b

New changeset 637c67b34a1a by Stefan Krah in branch 'default':
Merge fix for issue #11149.
http://hg.python.org/cpython/rev/637c67b34a1a

New changeset feed6d2097b1 by Stefan Krah in branch '2.7':
Backport fix for issue #11149.
http://hg.python.org/cpython/rev/feed6d2097b1

--
nosy: +python-dev

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



[issue12720] Expose linux extended filesystem attributes

2011-09-14 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

The OS X buildbots fail to compile posixmodule.c:

gcc -fno-strict-aliasing -g -O0 -Wall -Wstrict-prototypes-I. -I./Include
-DPy_BUILD_CORE  -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c: In function ‘try_getxattr’:
./Modules/posixmodule.c:10045: error: ‘XATTR_SIZE_MAX’ undeclared (first use in 
this function)
./Modules/posixmodule.c:10045: error: (Each undeclared identifier is reported 
only once
./Modules/posixmodule.c:10045: error: for each function it appears in.)
./Modules/posixmodule.c: In function ‘getxattr_common’:
./Modules/posixmodule.c:10083: error: ‘XATTR_SIZE_MAX’ undeclared (first use in 
this function)
./Modules/posixmodule.c: In function ‘posix_getxattr’:
./Modules/posixmodule.c:10101: warning: passing argument 3 of ‘getxattr_common’ 
from incompatible pointer type
./Modules/posixmodule.c: In function ‘posix_lgetxattr’:
./Modules/posixmodule.c:10119: error: ‘lgetxattr’ undeclared (first use in this 
function)
./Modules/posixmodule.c: In function ‘wrap_fgetxattr’:
./Modules/posixmodule.c:10129: error: too few arguments to function ‘fgetxattr’
./Modules/posixmodule.c:10130: warning: control reaches end of non-void function
./Modules/posixmodule.c: In function ‘posix_setxattr’:
./Modules/posixmodule.c:10165: error: too few arguments to function ‘setxattr’
./Modules/posixmodule.c: In function ‘posix_lsetxattr’:
./Modules/posixmodule.c:10190: warning: implicit declaration of function 
‘lsetxattr’
./Modules/posixmodule.c: In function ‘posix_fsetxattr’:
./Modules/posixmodule.c:10216: error: too few arguments to function ‘fsetxattr’
./Modules/posixmodule.c: In function ‘posix_removexattr’:
./Modules/posixmodule.c:10239: error: too few arguments to function 
‘removexattr’
./Modules/posixmodule.c: In function ‘posix_lremovexattr’:
./Modules/posixmodule.c:10262: warning: implicit declaration of function 
‘lremovexattr’
./Modules/posixmodule.c: In function ‘posix_fremovexattr’:
./Modules/posixmodule.c:10285: error: too few arguments to function 
‘fremovexattr’
./Modules/posixmodule.c: In function ‘listxattr_common’:
./Modules/posixmodule.c:10327: error: ‘XATTR_LIST_MAX’ undeclared (first use in 
this function)
./Modules/posixmodule.c: In function ‘posix_listxattr’:
./Modules/posixmodule.c:10369: warning: passing argument 2 of 
‘listxattr_common’ from incompatible pointer type
./Modules/posixmodule.c: In function ‘posix_llistxattr’:
./Modules/posixmodule.c:10385: error: ‘llistxattr’ undeclared (first use in 
this function)
./Modules/posixmodule.c: In function ‘wrap_flistxattr’:
./Modules/posixmodule.c:10394: error: too few arguments to function ‘flistxattr’
./Modules/posixmodule.c:10395: warning: control reaches end of non-void function
./Modules/posixmodule.c: In function ‘all_ins’:
./Modules/posixmodule.c:11342: error: ‘XATTR_SIZE_MAX’ undeclared (first use in 
this function)
make: *** [Modules/posixmodule.o] Error 1
program finished with exit code 2
elapsedTime=20.601350

--
nosy: +skrah
status: closed - open

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



[issue12978] Figure out extended attributes on BSDs

2011-09-14 Thread Benjamin Peterson

New submission from Benjamin Peterson benja...@python.org:

Extended attribute support currently exists in the os module for Linux. BSD's 
(including OSX) have a similar (but of course incompatible) interface. They 
should be exposed through the same functions. For example,

os.getxattr(myfile, user.whatever)

should call on the C level

getxattr(myfile, user.whatever, value, sizeof(value), 0, 0);

--
messages: 144028
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: Figure out extended attributes on BSDs
versions: Python 3.3

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



[issue12720] Expose linux extended filesystem attributes

2011-09-14 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset f325439d7f84 by Benjamin Peterson in branch 'default':
only compile xattrs on glibc (closes #12720)
http://hg.python.org/cpython/rev/f325439d7f84

--
status: open - closed

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



[issue12936] armv5tejl segfaults: sched_setaffinity() vs. pthread_setaffinity_np()

2011-09-14 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

I'd prefer to disable the misbehaving functions entirely on arm.
With the patch this combination of tests now works:

  ./python -m test -uall test_posix test_nntplib


If you think the patch is good, I can run the whole test suite, too.
[I'd rather wait for review due to the slowness of the setup.]

--
keywords: +patch
Added file: http://bugs.python.org/file23154/arm_setaffinity.diff

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



[issue12936] armv5tejl segfaults: sched_setaffinity() vs. pthread_setaffinity_np()

2011-09-14 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 I'd prefer to disable the misbehaving functions entirely on arm.

-10

If we start disabling features on platforms with partly bogus implementations, 
we might as well drop threading on OpenBSD, sendmsg() on OS-X, etc.

Furthermore, it's really just a libc bug, which might be fixed in a more recent 
version, or with another libc provider (eglibc, uclibc, etc.).

--

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



[issue7201] double Endian problem and more on arm

2011-09-14 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

OK, I got an OABI system setup.  I am seeing the 'test_struct_return_2H' 
failure, which actually segfaults in my setup.  The difference does, 
indeed, seem like an ABI mismatch.

The test code that is failing has a Python side like:

   def test_struct_return_2H(self):
class S2H(Structure):
_fields_ = [(x, c_short),
(y, c_short)]
dll.ret_2h_func.restype = S2H
dll.ret_2h_func.argtypes = [S2H]
inp = S2H(99, 88)
s2h = dll.ret_2h_func(inp)
self.assertEqual((s2h.x, s2h.y), (99*2, 88*3))

and a C code side that looks like:

   typedef struct {
  short x;
  short y;
   } S2H;

   S2H ret_2h_func(S2H inp)
   {
  inp.x *= 2;
  inp.y *= 3;
  return inp;
   }

The APCS Section 5.4 Result Return [1], says:


A Composite Type not larger than 4 bytes is returned in r0.  The format 
is as if the result had been stored in memory at a word-aligned address 
and then loaded into r0 with an LDR instruction.  Any bits in r0 that 
lie outside the bounds of the result have unspecified values.


The EABI implementation does exactly this and packs the structure into r0, 
where as the OABI implementation places the address of a structure in r0.  
'ctypes' is assuming the former and on an OABI system the contents of r0 are 
treated as an address, where they are actually a value.  Boom goes the dynamite.

I am looking into 'test_endian_double' and 
'test_unaligned_native_struct_fields' now.

[1] http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf

--

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



[issue7201] double Endian problem and more on arm

2011-09-14 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

The 'test_endian_double' test fails because the 'double' floating-point 
type for an interpreter built for OABI is unknown:

 float.__getformat__(float)
'IEEE, little-endian'
 float.__getformat__(double)
'unknown'

According to [1], the double format discrepancies seem to be expected.

[1] http://wiki.debian.org/ArmEabiPort#ARM_floating_points

--

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



[issue12973] int_pow() implementation is incorrect

2011-09-14 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Here's a simple patch.  Is anyone in a good position to see if this fixes the 
tests failures for Clang (without the fwrapv flag)?

--
keywords: +patch
Added file: http://bugs.python.org/file23155/issue12975.diff

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



[issue12978] Figure out extended attributes on BSDs

2011-09-14 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Have you looked at Bob Ippolito's xattr module which has been out for some time 
and wraps Linux, OS X, BSD, and Solaris extended attributes?

http://pypi.python.org/pypi/xattr

--
nosy: +ned.deily

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



[issue12979] tkinter.font.Font object not usable as font option

2011-09-14 Thread ilikepython

New submission from ilikepython patric...@gmx.de:

If a Font object is passed as a font option to a Tk widget e. g.:

import tkinter
import tkinter.font

f = tkinter.font.Font(family='Arial', size=30)
root = Tk()
label = tkinter.Label(root, text=Hello, font=f)
label.pack()

the font does not get respected at runtime.

--
messages: 144036
nosy: ilikepython
priority: normal
severity: normal
status: open
title: tkinter.font.Font object not usable as font option
type: behavior
versions: Python 3.2

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



[issue12976] select module: only use EVFILT_TIMER if available (kqueue backend)

2011-09-14 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Hello,

According to http://fxr.watson.org/fxr/ident?v=NETBSD;im=3;i=EVFILT_TIMER 
EVFILT_TIMER is defined on NetBSD.
As for MirBSD, with all due respect, it really looks like a niche platform, 
definitely not officially supported by Python.
Of course, this patch is so trivial and small that it can easily be merged, but 
it would be nice if MirBSD defined it in its header file instead (it's not the 
first problem due to kqueue-incompatibilities between on BSD platforms, see for 
example issue #12181 and issue #6419).

--
nosy: +haypo, neologix

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



[issue12973] int_pow() implementation is incorrect

2011-09-14 Thread STINNER Victor

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

I removed -fwrapv from configure and Makefile, but I'm unable to reproduce the 
issue with clang 2.8 on x86_64 (Fedora 15).

--
nosy: +haypo

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



[issue12976] select module: only use EVFILT_TIMER if available (kqueue backend)

2011-09-14 Thread Benny Siegert

Benny Siegert bsieg...@gmail.com added the comment:

There are actually only two things that need to be touched for supporting 
MirBSD: This and the Configure script. I was planning to submit the Configure 
patches separately, I just started with this patch as it is so trivial.

--

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



[issue12973] int_pow() implementation is incorrect

2011-09-14 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Thanks Victor; I just managed to install Clang, and it looks I can reproduce 
the failures.  I'm testing right now to see if the patch fixes them all...

--

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



  1   2   >