Re: Exception Handling (C - extending python)

2011-10-25 Thread Ulrich Eckhardt

Am 23.10.2011 14:41, schrieb Stefan Behnel:

That's just fine. If you are interested in the inner mechanics of the
CPython runtime, reading the source is a very good way to start getting
involved with the project.

However, many extension module authors don't care about these inner
mechanics and just use Cython instead. That keeps them from having to
learn the C-API of CPython, and from tying their code too deeply into
the CPython runtime itself.


Could you elaborate a bit? What are the pros and cons of writing an 
extension module using the Cython API compared to using the CPyothon 
API? In particular, how portable is it? Can I compile a module in one 
and use it in the other? Don't I just tie myself to a different API, but 
tie myself nonetheless?


Thank you!

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


Re: spawnl issues with Win 7 access rights

2011-10-25 Thread Propad
On 25 Okt., 02:21, Miki Tebeka miki.teb...@gmail.com wrote:
 Please use the subprocess module, it's the one who's actively 
 maintained.http://docs.python.org/library/subprocess.html#replacing-the-os-spawn...

Thnx again for all the answers. As stated before, I'm limited in my
options. One of them just might be to switch to Python 2.5, rewrite
the code that crashes using the subprocess module, and then somehow
patch the library I use (which I'm not suposed to do, but... oh
well :-)). I can just hope subrocess was already mature adn offering
the relevant functionality in 2.5.

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


[wanted] python-ldap for Python 2.3 / Win32

2011-10-25 Thread Gilles Lenfant
Hi,

I have spent a couple of hours asking google, browsing Pypi, SF, and of course 
the official www.python-ldap.org site searching for a python-ldap installer for 
Python 2.3 on Windows 32 bits. Unsuccessfully :(

As I need to add this to an ooold Plone site, it is not easy to upgrade to a 
newer Python version. So, please don't tell me to upgrade ;)

Many thanks by advance to the people who will help me. You can send this 
package via mail to gillesDOTlenfantATgmailDOTcom.

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


UnicodeError instead of UnicodeWarning

2011-10-25 Thread Michael Ströder
HI!

For tracking the cause of a UnicodeWarning I'd like to make the Python
interpreter to raise an UnicodeError exception with full stack trace. Is there
a short trick to achieve this?

Many thanks in advance.

Ciao, Michael.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UnicodeError instead of UnicodeWarning

2011-10-25 Thread Chris Rebert
2011/10/25 Michael Ströder mich...@stroeder.com:
 HI!

 For tracking the cause of a UnicodeWarning I'd like to make the Python
 interpreter to raise an UnicodeError exception with full stack trace. Is there
 a short trick to achieve this?

from exceptions import UnicodeWarning
from warnings import filterwarnings
filterwarnings(action=error, category=UnicodeWarning)

This will cause UnicodeWarnings to be raised as exceptions when they occur.

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


Re: What is wrong with my code?

2011-10-25 Thread Anssi Saari
apometron apometron.listas.ci...@gmail.com writes:

 Now it is another
 thing, entirely. Rename1.py and Rename2.py works, but why Rename3.py
 dont works?

Well, Rename3.py works for me, even in Windows 7. Maybe you should test
it again?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UnicodeError instead of UnicodeWarning

2011-10-25 Thread Peter Otten
Michael Ströder wrote:

 For tracking the cause of a UnicodeWarning I'd like to make the Python
 interpreter to raise an UnicodeError exception with full stack trace. Is
 there a short trick to achieve this?

You can control warning behaviour with the -W commandline option:

$ cat unicodewarning_demo.py
# -*- coding: utf-8 -*-

def g():
ä == uä

def f(n=3):
if n:
f(n-1)
else:
g()

if __name__ == __main__:
f()

$ python unicodewarning_demo.py
unicodewarning_demo.py:4: UnicodeWarning: Unicode equal comparison failed to 
convert both arguments to Unicode - interpreting them as being unequal
  ä == uä
$ python -W error::UnicodeWarning unicodewarning_demo.py
Traceback (most recent call last):
  File unicodewarning_demo.py, line 13, in module
f()
  File unicodewarning_demo.py, line 8, in f
f(n-1)
  File unicodewarning_demo.py, line 8, in f
f(n-1)
  File unicodewarning_demo.py, line 8, in f
f(n-1)
  File unicodewarning_demo.py, line 10, in f
g()
  File unicodewarning_demo.py, line 4, in g
ä == uä
UnicodeWarning: Unicode equal comparison failed to convert both arguments to 
Unicode - interpreting them as being unequal
$


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


Re: Exception Handling (C - extending python)

2011-10-25 Thread Stefan Behnel

Ulrich Eckhardt, 25.10.2011 08:49:

Am 23.10.2011 14:41, schrieb Stefan Behnel:

That's just fine. If you are interested in the inner mechanics of the
CPython runtime, reading the source is a very good way to start getting
involved with the project.

However, many extension module authors don't care about these inner
mechanics and just use Cython instead. That keeps them from having to
learn the C-API of CPython, and from tying their code too deeply into
the CPython runtime itself.


Could you elaborate a bit? What are the pros and cons of writing an
extension module using the Cython API compared to using the CPyothon API?


No cons. ;)

Cython is not an API, it's a programming language. It's Python, but with 
extended support for talking to C/C++ code (and also Fortran). That means 
that you don't have to use the C-API yourself, because Cython will do it 
for you.




In particular, how portable is it? Can I compile a module in one and use it
in the other?


They both use the CPython C-API internally. It's just that you are not 
using it explicitly in your code, so you (can) keep your own code free of 
CPython-isms.


It's substantially more portable than the usual hand-written code, 
because it generates C code for you that compiles and works in CPython 2.4 
up to the latest 3.3 in-development version, and also with all major C/C++ 
compilers, etc. It also generates faster glue code than you would write, 
e.g. for data type conversion and argument unpacking in function calls. So 
it speeds up thin wrappers automatically for you.


That doesn't mean that you can't get the same level of speed and 
portability in hand-written code. It just means that you don't have to do 
it yourself. Saves a lot of time, both during development and later during 
the maintenance cycle. Basically, it allows you to focus on the 
functionality you want to implement, rather than the implementation details 
of CPython, and also keeps the maintenance overhead at that level for you.




Don't I just tie myself to a different API, but tie myself
nonetheless?


There's a port to plain Python+ctypes underways, for example, which you 
could eventually use in PyPy. Try to do that at the C-API level.


Stefan

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


Re: What is wrong with my code?

2011-10-25 Thread apometron

I did it very much times, Anssi.

Beyond of run it on Python 2.7 latest build, what do you suggest?

Do install Python 3.2 along the Python 2.7 installation could give me 
any problems?


cheers,
Apometron
http://about.me/apometron

On 10/25/2011 6:11 AM, Anssi Saari wrote:

apometronapometron.listas.ci...@gmail.com  writes:


Now it is another
thing, entirely. Rename1.py and Rename2.py works, but why Rename3.py
dont works?

Well, Rename3.py works for me, even in Windows 7. Maybe you should test
it again?


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


Re: [wanted] python-ldap for Python 2.3 / Win32

2011-10-25 Thread Michael Ströder
Gilles Lenfant wrote:
 I have spent a couple of hours asking google, browsing Pypi, SF, and of
 course the official www.python-ldap.org site searching for a python-ldap
 installer for Python 2.3 on Windows 32 bits. Unsuccessfully :(

In theory even recent python-ldap 2.4.3 should still work with Python 2.3.
Please post your inquiry on the mailing-list python-l...@python.org (subscribe
before post). Maybe you can convince the maintainer of the Win32 packages there.

Ciao, Michael.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Tutor] What is wrong with my code?

2011-10-25 Thread Dave Angel

(Once again, please don't top-post.  It makes your responses out of order)

On 10/25/2011 04:24 AM, apometron wrote:

I did it very much times, Anssi.

Beyond of run it on Python 2.7 latest build, what do you suggest?

Do install Python 3.2 along the Python 2.7 installation could give me 
any problems?




Why don't you say publicly that you aren't using cmd ?

If your file manager is not running the equivalent of


python  yourprogram.py filename.txt


then everyone here is chasing a wild goose.

Switch to the command line, issue a sequence of commands that cause the 
failure, and paste them in a message here.  Then if it works, but 
doesn't from your file manager, you/we/they can address the differences 
from the working command line.




--

DaveA

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


Re: [Tutor] What is wrong with my code?

2011-10-25 Thread apometron

On 10/25/2011 7:34 AM, Dave Angel wrote:
(Once again, please don't top-post.  It makes your responses out of 
order)


On 10/25/2011 04:24 AM, apometron wrote:

I did it very much times, Anssi.

Beyond of run it on Python 2.7 latest build, what do you suggest?

Do install Python 3.2 along the Python 2.7 installation could give me 
any problems?




Why don't you say publicly that you aren't using cmd ?

If your file manager is not running the equivalent of


python  yourprogram.py filename.txt


then everyone here is chasing a wild goose.

Switch to the command line, issue a sequence of commands that cause 
the failure, and paste them in a message here.  Then if it works, but 
doesn't from your file manager, you/we/they can address the 
differences from the working command line.




I found out what it is.

It is the File Commander giving wrong informations to the script.

In Take Command command line it works sweet.

I will show all this to the File Commander author and ask him some way 
to solve this.


It turns out do the thing in command line every time is not best way. I 
need do it by the file manager.


But the file manager was puting stones in the way.

Take Command has a script language also, but I would like do the things 
in Python, if possible.


And this difficulty with File Commander makes use Python a thing less 
easy to do.


Question solved. It was not Take Command the problem and I was sure it 
was not.


Enter in command line to do things is a pain. =( I mean, e-ve-ry ti-me.

But then, good news, all the three scripts works smoothly in the command 
line.


Do you believe drag and drop in the Windows Explorer can be my salvation?

Cool thing to try.

[]s
Apometron
http://about.me/apometron


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


Strange classmethod mock behavior

2011-10-25 Thread Fabio Zadrozny
I'm trying to mock a classmethod in a superclass but when restoring it
a strange behavior happens in subclasses (tested on Python 2.5)

Anyone knows why this happens? (see test case below for details)
Is there any way to restore that original method to have the original behavior?

import unittest

class Test(unittest.TestCase):

def testClassmethod(self):
class Super():
@classmethod
def GetCls(cls):
return cls

class Sub(Super):
pass

self.assertEqual(Sub.GetCls(), Sub)

original = Super.GetCls
#Mock Super.GetCls, and do tests...
Super.GetCls = original #Restore the original classmethod
self.assertEqual(Sub.GetCls(), Sub) #The call to the
classmethod subclass returns the cls as Super and not Sub as expected!

if __name__ == '__main__':
unittest.main()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Strange classmethod mock behavior

2011-10-25 Thread Peter Otten
Fabio Zadrozny wrote:

 I'm trying to mock a classmethod in a superclass but when restoring it
 a strange behavior happens in subclasses (tested on Python 2.5)
 
 Anyone knows why this happens? (see test case below for details)
 Is there any way to restore that original method to have the original
 behavior?
 
 import unittest
 
 class Test(unittest.TestCase):
 
 def testClassmethod(self):
 class Super():
 @classmethod
 def GetCls(cls):
 return cls
 
 class Sub(Super):
 pass
 
 self.assertEqual(Sub.GetCls(), Sub)
 
 original = Super.GetCls
 #Mock Super.GetCls, and do tests...
 Super.GetCls = original #Restore the original classmethod
 self.assertEqual(Sub.GetCls(), Sub) #The call to the
 classmethod subclass returns the cls as Super and not Sub as expected!
 
 if __name__ == '__main__':
 unittest.main()

[Not related to your problem] When working with descriptors it's a good idea 
to use newstyle classes, i. e. have Super inherit from object.

The Super.GetCls attribute access is roughly equivalent to

Super.__dict___[GetCls].__get__(classmethod_instance, None, Super) 

and returns an object that knows about its class. So when you think you are 
restoring the original method you are actually setting the GetCls attribute 
to something else. You can avoid the problem by accessing the attribute 
explicitly:

 class Super(object):
... @classmethod
... def m(cls): return cls
...
 bad = Super.m
 good = Super.__dict__[m]
 class Sub(Super): pass
...
 Sub.m()
class '__main__.Sub'
 Super.m = bad
 Sub.m()
class '__main__.Super'
 Super.m = good
 Sub.m()
class '__main__.Sub'


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


Re: spawnl issues with Win 7 access rights

2011-10-25 Thread Tim Golden

On 25/10/2011 08:01, Propad wrote:

Thnx again for all the answers. As stated before, I'm limited in my
options. One of them just might be to switch to Python 2.5, rewrite
the code that crashes using the subprocess module, and then somehow
patch the library I use (which I'm not suposed to do, but... oh
well :-)). I can just hope subrocess was already mature adn offering
the relevant functionality in 2.5.


I must admit I'm more than slightly surprised by this. My test case
is to use os.spawnl to run c:/windows/notepad.exe. From the docs,
I would expect to use os.spawnl (os.P_WAIT, c:/windows/notepad.exe).
(I only want to open notepad.exe; there's no need for additional args).

These are my test cases:

(1)

os.spawnl (
  os.P_WAIT,
  c:/windows/notepad.exe
)

(2)

os.spawnl (
  os.P_WAIT,
  c:/windows/notepad.exe,
  c:/windows/notepad.exe
)

(3)

os.spawnl (
  os.P_WAIT,
  c:/windows/notepad.exe,
  c:/windows/notepad.exe,
  c:/temp.txt
)


And the results:

==
Python | Platform | Case | Result
--
2.2.2  | WinXP| 1| Works (empty notepad)
2.2.2  | WinXP| 2| Works (empty notepad)
2.2.2  | WinXP| 3| Works (notepad temp.txt)
--
2.2.2  | Win7 | 1| OSError
2.2.2  | Win7 | 2| Works (empty notepad)
2.2.2  | Win7 | 3| Works (notepad temp.txt)
--
2.7.2  | WinXP| 1| Crashes
2.7.2  | WinXP| 2| Works (empty notepad)
2.7.2  | WinXP| 3| Works (notepad temp.txt)
--
2.7.2  | Win7 | 1| Crashes
2.7.2  | Win7 | 2| Works (empty notepad)
2.7.2  | Win7 | 3| Works (notepad temp.txt)
==


Add to this a look at the mscrt source which ships with VS 2008
and the MSDN docs for spawnl:

http://msdn.microsoft.com/en-us/library/wweek9sc%28v=vs.80%29.aspx

and we see that the first args parameter must be the same as the
path parameter.

FWIW, at no extra cost, I went to the trouble of testing it on some
flavour of Linux with Python 2.6 and got the same results
as per 2.2.2 on WinXP. (Basically: everything works).

Which leaves us with http://bugs.python.org/issue8036 in which recent
versions of Python crash when the (arbitrary) second parameter isn't
passed. And with an inexplicable behaviour change between the same
version of Python running on WinXP and on Win7.

It looks as though the workaround for your problem (or, possibly,
your failure to fulfil some artificial parameter requirements) is
to add the executable again as the third parameter.

issue8036 (which also affects the execl family) has a patch waiting
for review, which hopefully we can get round to fixing. As far as I
can tell, the execl/spawnl family of functions isn't currently
represented in the testsuite.

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


webapp development in pure python

2011-10-25 Thread Laszlo Nagy


  Hi,

Anyone knows a framework for webapp development? I'm not talking about 
javascript/html compilers and ajax frameworks. I need something that 
does not require javascript knowledge, just pure Python. (So qooxdoo is 
not really an option, because it cannot be programmed in Python. You 
cannot even put out a window on the center of the screen without using 
javascript code, and you really have to be a javascript expert to write 
useful applications with qooxdoo.)


What I need is a programmable GUI with windows, event handlers and 
extensible widgets, for creating applications that use http/https and a 
web browser for rendering.


Is there something like this already available?

Thanks,

   Laszlo



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


Re: webapp development in pure python

2011-10-25 Thread Anurag Chourasia
Have you considered Django ?

http://www.djangoproject.com/ https://www.djangoproject.com/

Regards,
Anurag

On Tue, Oct 25, 2011 at 7:20 PM, Laszlo Nagy gand...@shopzeus.com wrote:


  Hi,

 Anyone knows a framework for webapp development? I'm not talking about
 javascript/html compilers and ajax frameworks. I need something that does
 not require javascript knowledge, just pure Python. (So qooxdoo is not
 really an option, because it cannot be programmed in Python. You cannot even
 put out a window on the center of the screen without using javascript code,
 and you really have to be a javascript expert to write useful applications
 with qooxdoo.)

 What I need is a programmable GUI with windows, event handlers and
 extensible widgets, for creating applications that use http/https and a web
 browser for rendering.

 Is there something like this already available?

 Thanks,

   Laszlo



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

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


Re: webapp development in pure python

2011-10-25 Thread Arnaud Delobelle
On 25 October 2011 14:50, Laszlo Nagy gand...@shopzeus.com wrote:

  Hi,

 Anyone knows a framework for webapp development? I'm not talking about
 javascript/html compilers and ajax frameworks. I need something that does
 not require javascript knowledge, just pure Python. (So qooxdoo is not
 really an option, because it cannot be programmed in Python. You cannot even
 put out a window on the center of the screen without using javascript code,
 and you really have to be a javascript expert to write useful applications
 with qooxdoo.)

 What I need is a programmable GUI with windows, event handlers and
 extensible widgets, for creating applications that use http/https and a web
 browser for rendering.

So you're looking for something like Google Web Toolkit but using
Python instead of Java...

Do you know about pyjamas (http://pyjs.org/)?  I've never used it, but
I think it endeavours to be what you are looking for.

HTH

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


Re: webapp development in pure python

2011-10-25 Thread Martin P. Hellwig

On 10/25/11 15:13, Arnaud Delobelle wrote:

On 25 October 2011 14:50, Laszlo Nagygand...@shopzeus.com  wrote:


  Hi,

Anyone knows a framework for webapp development? I'm not talking about
javascript/html compilers and ajax frameworks. I need something that does
not require javascript knowledge, just pure Python. (So qooxdoo is not
really an option, because it cannot be programmed in Python. You cannot even
put out a window on the center of the screen without using javascript code,
and you really have to be a javascript expert to write useful applications
with qooxdoo.)

What I need is a programmable GUI with windows, event handlers and
extensible widgets, for creating applications that use http/https and a web
browser for rendering.


So you're looking for something like Google Web Toolkit but using
Python instead of Java...

Do you know about pyjamas (http://pyjs.org/)?  I've never used it, but
I think it endeavours to be what you are looking for.

HTH



Second that, I use it for a couple of my projects for exactly that.

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


Re: Creating very similar functions with different parameters

2011-10-25 Thread Ian Kelly
On Mon, Oct 24, 2011 at 3:29 PM, Andrew Berg bahamutzero8...@gmail.com wrote:
 I want to create a decorator with two different (but very similar)
 versions of the wrapper function, but without copying giant chunks of
 similar code. The main difference is that one version takes extra
 parameters.

 def test_dec(func, extra=False):
        if extra:
                def wrapper(ex_param1, ex_param2, *args, **kwargs):
                        print('bla bla')
                        print('more bla')
                        print(ex_param1)
                        print(ex_param2)
                        func(ex_param1, ex_param2, *args, **kwargs)
        else:
                def wrapper(*args, **kwargs):
                        print('bla bla')
                        print('more bla')
                        func(*args, **kwargs)
        return wrapper

 If the function I'm wrapping takes ex_param1 and ex_param2 as
 parameters, then the decorator should print them and then execute the
 function, otherwise just execute the function. I'd rather not write
 separate wrappers that are mostly the same.

Others have given more involved suggestions, but in this case you
could just make the wrapper a closure and check the flag there:

def test_dec(func, extra=False):
def wrapper(*args, **kwargs):
print('bla bla')
print('more bla')
if extra:
ex_param1, ex_param2 = args[:2]
print(ex_param1)
print(ex_param2)
func(*args, **kwargs)
return wrapper

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


Re: Creating very similar functions with different parameters

2011-10-25 Thread 88888 Dihedral
Thanks for the debug modes in functional programing! Everything functional is 
true in CS at least in the theroy!   
-- 
http://mail.python.org/mailman/listinfo/python-list


Data acquisition

2011-10-25 Thread spintronic
Dear friends,

I have a trouble with understanding the following. I have a very short
script (shown below) which works fine if I run step by step (or line
by line) in Python shell (type the first line/command - press Enter,
etc.). I can get all numbers (actually, there are no numbers but a
long string, but this is not a problem) I need from a device:

'0.3345098119,0.01069121274,0.02111624694,0.03833379529,0.02462816409,0.0774275008,0.06554297421,0.07366750919,0.08122602002,0.004018369318,0.03508462415,0.04829900696,0.06383554085,
 ...'

However, when I start very the same list of commands as a script, it
gives me the following, which is certainly wrong:

[0.0, 0.0, 0.0, 0.0, 0.0,...]

Any ideas? Why there is a difference when I run the script or do it
command by command?

===
from visa import *

mw = instrument(GPIB0::20::INSTR, timeout = None)

mw.write(*RST)
mw.write(CALC1:DATA? FDATA)

a=mw.read()

print a
===
(That is really all!)


PS In this case I use Python Enthought for Windows, but I am not an
expert in Windows (I work usually in Linux but now I need to run this
data acquisition under Windows).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Data acquisition

2011-10-25 Thread Jean-Michel Pichavant

spintronic wrote:

Dear friends,

I have a trouble with understanding the following. I have a very short
script (shown below) which works fine if I run step by step (or line
by line) in Python shell (type the first line/command - press Enter,
etc.). I can get all numbers (actually, there are no numbers but a
long string, but this is not a problem) I need from a device:

'0.3345098119,0.01069121274,0.02111624694,0.03833379529,0.02462816409,0.0774275008,0.06554297421,0.07366750919,0.08122602002,0.004018369318,0.03508462415,0.04829900696,0.06383554085,
 ...'

However, when I start very the same list of commands as a script, it
gives me the following, which is certainly wrong:

[0.0, 0.0, 0.0, 0.0, 0.0,...]

Any ideas? Why there is a difference when I run the script or do it
command by command?

===
from visa import *

mw = instrument(GPIB0::20::INSTR, timeout = None)

mw.write(*RST)
mw.write(CALC1:DATA? FDATA)

a=mw.read()

print a
===
(That is really all!)


PS In this case I use Python Enthought for Windows, but I am not an
expert in Windows (I work usually in Linux but now I need to run this
data acquisition under Windows).
  


Just in case you have a local installation of visa and it silently fails 
on some import,


try to add at the begining of your script:
import sys
sys.path.append('')

When using the python shell cmd line, '' is added to sys.path by the 
shell, that is one difference that can make relative imports fail in 
your script.


If it's still not working, well, it means the problem is somewhere else.

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


Re: webapp development in pure python

2011-10-25 Thread Laszlo Nagy



Anyone knows a framework for webapp development? I'm not talking about
javascript/html compilers and ajax frameworks. I need something that 
does

not require javascript knowledge, just pure Python. (So qooxdoo is not
really an option, because it cannot be programmed in Python. You 
cannot even
put out a window on the center of the screen without using 
javascript code,
and you really have to be a javascript expert to write useful 
applications

with qooxdoo.)

What I need is a programmable GUI with windows, event handlers and
extensible widgets, for creating applications that use http/https 
and a web

browser for rendering.


So you're looking for something like Google Web Toolkit but using
Python instead of Java...

Do you know about pyjamas (http://pyjs.org/)?  I've never used it, but
I think it endeavours to be what you are looking for.
As I told, I'm not talking about javascript/html compilers and ajax 
frameworks. Pyjamas is both a javascript compiler and  an ajax 
framework. My Python module would connect to a database server and query 
some data, then display it in a grid. This cannot be compiled into 
javascript because of the database server connection. With pyjamas, I 
would have to create the server side part separately, the user interface 
separately, and hand-code the communication between the widets and the 
server side. I would like to use this theoretical web based framework 
just like pygtk or wxPython: create windows, place widgets on them, 
implement event handlers etc. and access the widgets and other server 
side resources (for example, a database connection) from the same source 
code. Transparently. So the web part would really just be the rendering 
part of the user inferface. This may not be possible at all..


My other idea was to use a freenx server and wxPython. Is it a better 
solution? Have anyone used this combination from an android tablet, for 
example? Would it work?


Thanks,

   Laszlo

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


Re: Data acquisition

2011-10-25 Thread Nick Dokos
spintronic sidorenko.and...@gmail.com wrote:

 Dear friends,
 
 I have a trouble with understanding the following. I have a very short
 script (shown below) which works fine if I run step by step (or line
 by line) in Python shell (type the first line/command - press Enter,
 etc.). I can get all numbers (actually, there are no numbers but a
 long string, but this is not a problem) I need from a device:
 
 '0.3345098119,0.01069121274,0.02111624694,0.03833379529,0.02462816409,0.0774275008,0.06554297421,0.07366750919,0.08122602002,0.004018369318,0.03508462415,0.04829900696,0.06383554085,
  ...'
 
 However, when I start very the same list of commands as a script, it
 gives me the following, which is certainly wrong:
 
 [0.0, 0.0, 0.0, 0.0, 0.0,...]
 
 Any ideas? Why there is a difference when I run the script or do it
 command by command?
 
 ===
 from visa import *
 
 mw = instrument(GPIB0::20::INSTR, timeout = None)
 
 mw.write(*RST)
 mw.write(CALC1:DATA? FDATA)
 
 a=mw.read()
 
 print a
 ===
 (That is really all!)
 
 
 PS In this case I use Python Enthought for Windows, but I am not an
 expert in Windows (I work usually in Linux but now I need to run this
 data acquisition under Windows).
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 

Shot in the dark: could it be that you have to add delays to give the
instrument time to adjust? When you do it from the python shell, line by
line, there is a long delay between one line and the next.

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


Re: Data acquisition

2011-10-25 Thread John Gordon
In 362e368f-829e-4477-bcfc-c0650d231...@j7g2000yqi.googlegroups.com 
spintronic sidorenko.and...@gmail.com writes:

 Any ideas? Why there is a difference when I run the script or do it
 command by command?

Are you running the same python program in both cases?

Are you in the same directory in both cases?

Does PYTHONPATH and/or sys.path have the same value in both cases?

Show us an exact transscript of both executions.

-- 
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: Data acquisition

2011-10-25 Thread spintronic
On Oct 25, 6:29 pm, Nick Dokos nicholas.do...@hp.com wrote:
 Shot in the dark: could it be that you have to add delays to give the
 instrument time to adjust? When you do it from the python shell, line by
 line, there is a long delay between one line and the next.

 Nick

Hi, Nick!

Thanks! You are right but it was the first thing I thought about. So I
have tried to delay using sleep(t) from the time module (I also sent
*OPC? or *WAI commands to a device for synchronization). However,
it does not help ...

Best,
AS
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Data acquisition

2011-10-25 Thread spintronic
On Oct 25, 6:43 pm, John Gordon gor...@panix.com wrote:

Thanks, John!

 Are you running the same python program in both cases?

Yes, the same.

 Are you in the same directory in both cases?
 Does PYTHONPATH and/or sys.path have the same value in both cases?

It looks that yes but how can it matter? All I need it is to import
the visa module and it works well.

 Show us an exact transscript of both executions.

There is nothing but numbers. Or do you mean something else? I do
not receive any errors, only different results ...

Best,
AS
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Data acquisition

2011-10-25 Thread spintronic
On Oct 25, 6:15 pm, Jean-Michel Pichavant jeanmic...@sequans.com
wrote:
 spintronic wrote:
  Dear friends,

  I have a trouble with understanding the following. I have a very short
  script (shown below) which works fine if I run step by step (or line
  by line) in Python shell (type the first line/command - press Enter,
  etc.). I can get all numbers (actually, there are no numbers but a
  long string, but this is not a problem) I need from a device:

  '0.3345098119,0.01069121274,0.02111624694,0.03833379529,0.02462816409,0.0774275008,0.06554297421,0.07366750919,0.08122602002,0.004018369318,0.03508462415,0.04829900696,0.06383554085,
   ...'

  However, when I start very the same list of commands as a script, it
  gives me the following, which is certainly wrong:

  [0.0, 0.0, 0.0, 0.0, 0.0,...]

  Any ideas? Why there is a difference when I run the script or do it
  command by command?

  ===
  from visa import *

  mw = instrument(GPIB0::20::INSTR, timeout = None)

  mw.write(*RST)
  mw.write(CALC1:DATA? FDATA)

  a=mw.read()

  print a
  ===
  (That is really all!)

  PS In this case I use Python Enthought for Windows, but I am not an
  expert in Windows (I work usually in Linux but now I need to run this
  data acquisition under Windows).

 Just in case you have a local installation of visa and it silently fails
 on some import,

 try to add at the begining of your script:
 import sys
 sys.path.append('')

 When using the python shell cmd line, '' is added to sys.path by the
 shell, that is one difference that can make relative imports fail in
 your script.

 If it's still not working, well, it means the problem is somewhere else.

 JM

Hi!

Thanks! I have just tried. Unfortunately, it does not work ...

Best,
AS
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Data acquisition

2011-10-25 Thread John Gordon
In 86e6bfb8-17e1-4544-97ba-7299db8a8...@p16g2000yqj.googlegroups.com 
spintronic sidorenko.and...@gmail.com writes:

  Are you in the same directory in both cases?
  Does PYTHONPATH and/or sys.path have the same value in both cases?

 It looks that yes but how can it matter? All I need it is to import
 the visa module and it works well.

If you run the two cases from different directories, and the current
directory is in PYTHONPATH or sys.path, and one of the directories
contains a python file named visa.py and the other doesn't, that
culd account for the difference in output.

Do you have access to the visa.py source code?  Can you add a simple
print statement near the top of the module so that we know the same
visa.py module is being imported in both cases?

  Show us an exact transscript of both executions.

 There is nothing but numbers. Or do you mean something else? I do
 not receive any errors, only different results ...

I was more interested in the exact commands you used to run both cases,
rather than the output.

-- 
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: How to isolate a constant?

2011-10-25 Thread Alan Meyer

On 10/22/2011 8:46 PM, MRAB wrote:

On 23/10/2011 01:26, Gnarlodious wrote:

Say this:

class tester():
_someList = [0, 1]
def __call__(self):
someList = self._someList
someList += X
return someList

test = tester()

But guess what, every call adds to the variable that I am trying to
copy each time:
test()

[0, 1, 'X']

test()

[0, 1, 'X', 'X']

...

Python will copy something only when you tell it to copy. A simple way
of copying a list is to slice it:

someList = self._someList[:]


And another simple way:

...
someList = list(self._someList)
...

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


Re: How to isolate a constant?

2011-10-25 Thread Ian Kelly
On Tue, Oct 25, 2011 at 1:50 PM, Alan Meyer amey...@yahoo.com wrote:
 Python will copy something only when you tell it to copy. A simple way
 of copying a list is to slice it:

 someList = self._someList[:]

 And another simple way:

    ...
    someList = list(self._someList)
    ...

I generally prefer the latter.  It's clearer, and it guarantees that
the result will be a list, which is usually what you want in these
situations, rather than whatever unexpected type was passed in.

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


Python developers interested in local communities, GroupServer

2011-10-25 Thread Steven Clift
My non-profit uses the GPL Python-based http://GroupServer.org
platform to host local neighborhood online communities in the U.S.,
the UK, and New Zealand. We are users of GroupServer and not the owner
of the project.

We are plotting a future new features hackathon (in person in
Minneapolis and perhaps simultaneously elsewhere) and are looking for
python programmers with a particular interest in connecting people in
local places.

If you are interested in learning more, please contact us at
t...@e-democracy.org or http://e-democracy.org/contact

Or join the GroupServer development group -
http://groupserver.org/groups/development - where we will definitely
making an announcement. We will also announce it here on the Local
Labs online group: http://e-democracy.org/labs

Thanks,
Steven Clift
E-Democracy.org

P.S. GroupServer is probably the best open source hybrid e-mail
list/web forum out there. Not the best e-mail list. And not the best
web forum. But the best fully integrated approach. Example use with
some customizations: http://e-democracy.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [wanted] python-ldap for Python 2.3 / Win32

2011-10-25 Thread Waldemar Osuch
I did try to build it using my current setup but it failed with some linking 
errors.
Oh well.

Google gods were nicer to me.  Here is a couple alternative links.
Maybe they will work for you.
http://web.archive.org/web/20081101060042/http://www.agescibs.org/mauro/
http://old.zope.org/Members/volkerw/LdapWin32/

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


Re: Data acquisition

2011-10-25 Thread Dietmar Schwertberger

Am 25.10.2011 19:22, schrieb spintronic:

On Oct 25, 6:29 pm, Nick Dokosnicholas.do...@hp.com  wrote:

Shot in the dark: could it be that you have to add delays to give the
instrument time to adjust? When you do it from the python shell, line by
line, there is a long delay between one line and the next.

Thanks! You are right but it was the first thing I thought about. So I
have tried to delay using sleep(t) from the time module (I also sent
*OPC? or *WAI commands to a device for synchronization). However,
it does not help ...


RST is resetting all data and CALC is somehow calculating and returning
data. Without a trigger between RST and CALC, I would not expect any
data...

Maybe the equipment is triggering continuously e.g. every second.
When you were using the shell, you had a good chance to see a trigger
between RST and CALC. With a script, it's not so likely.
OPC won't help, as it would wait for completion of a measurement, but if
you don't trigger, it won't wait.

What kind of instrument are you using? Check for the trigger command.
It may be something like INIT:IMM

Regards,

Dietmar

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


Re: [wanted] python-ldap for Python 2.3 / Win32

2011-10-25 Thread Gilles Lenfant
So many thanks for your valuable help Waldemar, this is exactly what I needed. 
I have no Windows machine to compile with the source bundle all this, and must 
install this directly in a production server.

I'll keep these precious links and files in a trunk.

Many thanks again
-- 
Gilles Lenfant
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Data acquisition

2011-10-25 Thread Paul Simon
spintronic sidorenko.and...@gmail.com wrote in message 
news:362e368f-829e-4477-bcfc-c0650d231...@j7g2000yqi.googlegroups.com...
 Dear friends,

 I have a trouble with understanding the following. I have a very short
 script (shown below) which works fine if I run step by step (or line
 by line) in Python shell (type the first line/command - press Enter,
 etc.). I can get all numbers (actually, there are no numbers but a
 long string, but this is not a problem) I need from a device:

 '0.3345098119,0.01069121274,0.02111624694,0.03833379529,0.02462816409,0.0774275008,0.06554297421,0.07366750919,0.08122602002,0.004018369318,0.03508462415,0.04829900696,0.06383554085,
  
 ...'

 However, when I start very the same list of commands as a script, it
 gives me the following, which is certainly wrong:

 [0.0, 0.0, 0.0, 0.0, 0.0,...]

 Any ideas? Why there is a difference when I run the script or do it
 command by command?

 ===
 from visa import *

 mw = instrument(GPIB0::20::INSTR, timeout = None)

 mw.write(*RST)
 mw.write(CALC1:DATA? FDATA)

 a=mw.read()

 print a
 ===
 (That is really all!)


 PS In this case I use Python Enthought for Windows, but I am not an
 expert in Windows (I work usually in Linux but now I need to run this
 data acquisition under Windows).

I'm almost certain that there is a turnaround timing issue that is causing 
the problem.  These are common problems in data aquisition systems.  The 
simplest solution is to loop and wait for end of line from the sending end 
and if necessary put in a time delay.  After receiving the data, check the 
received data for correct format, correct first and last characters, and if 
possible, check sum.  I've worked through this problem with rs-485 data 
collection systems where there is no hand shaking and would not be surprised 
to expect the same even with rs-232.

Paul Simon 


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


How to pretty-print ctypes composite data types?

2011-10-25 Thread Grant Edwards
I'm using ctypes with a library that requires a handful of structure
definitions.  The actual definitions and usage aren't a problem.  When
it comes time to print out the values in a structure or array, there
doesn't seem to be simple/general way to do that.  Am I missing
something?

I presume one can recursively iterate through the fields in a
structure and elements in an array, recursing on any composite types
and printing the values when one finds a type, but I'm surprised
that's not something that's already in the ctypes library somewhere --
the authors certainly seem to have thought of everything else.

-- 
Grant Edwards   grant.b.edwardsYow! I own seven-eighths of
  at   all the artists in downtown
  gmail.comBurbank!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Strange classmethod mock behavior

2011-10-25 Thread Fabio Zadrozny
On Tue, Oct 25, 2011 at 10:08 AM, Peter Otten __pete...@web.de wrote:
 Fabio Zadrozny wrote:

 I'm trying to mock a classmethod in a superclass but when restoring it
 a strange behavior happens in subclasses (tested on Python 2.5)

 Anyone knows why this happens? (see test case below for details)
 Is there any way to restore that original method to have the original
 behavior?

 import unittest

 class Test(unittest.TestCase):

     def testClassmethod(self):
         class Super():
             @classmethod
             def GetCls(cls):
                 return cls

         class Sub(Super):
             pass

         self.assertEqual(Sub.GetCls(), Sub)

         original = Super.GetCls
         #Mock Super.GetCls, and do tests...
         Super.GetCls = original #Restore the original classmethod
         self.assertEqual(Sub.GetCls(), Sub) #The call to the
 classmethod subclass returns the cls as Super and not Sub as expected!

 if __name__ == '__main__':
     unittest.main()

 [Not related to your problem] When working with descriptors it's a good idea
 to use newstyle classes, i. e. have Super inherit from object.

 The Super.GetCls attribute access is roughly equivalent to

 Super.__dict___[GetCls].__get__(classmethod_instance, None, Super)

 and returns an object that knows about its class. So when you think you are
 restoring the original method you are actually setting the GetCls attribute
 to something else. You can avoid the problem by accessing the attribute
 explicitly:

 class Super(object):
 ...     @classmethod
 ...     def m(cls): return cls
 ...
 bad = Super.m
 good = Super.__dict__[m]
 class Sub(Super): pass
 ...
 Sub.m()
 class '__main__.Sub'
 Super.m = bad
 Sub.m()
 class '__main__.Super'
 Super.m = good
 Sub.m()
 class '__main__.Sub'


Hi Peter, thanks for the explanation.

Printing it helped me understand it even better...

print(Super.__dict__['GetCls'])
print(Super.GetCls)

classmethod object at 0x022AF210
bound method type.GetCls of class '__main__.Super'

Cheers,

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


Re: How to isolate a constant?

2011-10-25 Thread Ian Kelly
On Tue, Oct 25, 2011 at 6:08 PM, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
 Where's the line form to split those who'd prefer the first vs the
 second result in this sample G:

 unExpected = What about a string
 firstToLast = unExpected[:]

Strings are immutable.  That doesn't suffice to copy them, even
assuming you would want to do so in the first place.

 unExpected is firstToLast
True

If you find yourself needing to make a copy, that usually means that
you plan on modifying either the original or the copy, which in turn
means that you need a type that supports modification operations,
which usually means a list.  If you pass in a string and then copy it
with [:] and then try to modify it, you'll get an exception.  If you
don't try to modify it, then you probably didn't need to copy it in
the first place.

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


Re: spawnl issues with Win 7 access rights

2011-10-25 Thread Terry Reedy

On 10/25/2011 8:19 AM, Tim Golden wrote:

On 25/10/2011 08:01, Propad wrote:

Thnx again for all the answers. As stated before, I'm limited in my
options. One of them just might be to switch to Python 2.5, rewrite
the code that crashes using the subprocess module, and then somehow
patch the library I use (which I'm not suposed to do, but... oh
well :-)). I can just hope subrocess was already mature adn offering
the relevant functionality in 2.5.


I must admit I'm more than slightly surprised by this. My test case
is to use os.spawnl to run c:/windows/notepad.exe. From the docs,
I would expect to use os.spawnl (os.P_WAIT, c:/windows/notepad.exe).
(I only want to open notepad.exe; there's no need for additional args).

These are my test cases:

(1)

os.spawnl (
os.P_WAIT,
c:/windows/notepad.exe
)

(2)

os.spawnl (
os.P_WAIT,
c:/windows/notepad.exe,
c:/windows/notepad.exe
)

(3)

os.spawnl (
os.P_WAIT,
c:/windows/notepad.exe,
c:/windows/notepad.exe,
c:/temp.txt
)


And the results:

==
Python | Platform | Case | Result
--
2.2.2 | WinXP | 1 | Works (empty notepad)
2.2.2 | WinXP | 2 | Works (empty notepad)
2.2.2 | WinXP | 3 | Works (notepad temp.txt)
--
2.2.2 | Win7 | 1 | OSError
2.2.2 | Win7 | 2 | Works (empty notepad)
2.2.2 | Win7 | 3 | Works (notepad temp.txt)
--
2.7.2 | WinXP | 1 | Crashes
2.7.2 | WinXP | 2 | Works (empty notepad)
2.7.2 | WinXP | 3 | Works (notepad temp.txt)
--
2.7.2 | Win7 | 1 | Crashes
2.7.2 | Win7 | 2 | Works (empty notepad)
2.7.2 | Win7 | 3 | Works (notepad temp.txt)
==


Add to this a look at the mscrt source which ships with VS 2008
and the MSDN docs for spawnl:

http://msdn.microsoft.com/en-us/library/wweek9sc%28v=vs.80%29.aspx

and we see that the first args parameter must be the same as the
path parameter.

FWIW, at no extra cost, I went to the trouble of testing it on some
flavour of Linux with Python 2.6 and got the same results
as per 2.2.2 on WinXP. (Basically: everything works).

Which leaves us with http://bugs.python.org/issue8036 in which recent
versions of Python crash when the (arbitrary) second parameter isn't
passed. And with an inexplicable behaviour change between the same
version of Python running on WinXP and on Win7.


OP reports 2.6 with XP works. Did that use VS 2005? Maybe C runtime 
changed (regressed). Also, could there be a 32 v. 64 bit issue?


--
Terry Jan Reedy

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


Re: How to isolate a constant?

2011-10-25 Thread Mel
Dennis Lee Bieber wrote:

 Where's the line form to split those who'd prefer the first vs the
 second result in this sample G:
 
 unExpected = What about a string
 firstToLast = unExpected[:]
 repr(firstToLast)
 'What about a string'
 explicitList = list(unExpected)
 repr(explicitList)
 ['W', 'h', 'a', 't', ' ', 'a', 'b', 'o', 'u', 't', ' ', 'a', ' ', 's',
 't', 'r', 'i', 'n', 'g']
 

Well, as things stand, there's a way to get whichever result you need.  The 
`list` constructor builds a single list from a single iterable.  The list 
literal enclosed by `[`, `]` makes a list containing a bunch of items.

Strings being iterable introduces a wrinkle, but `list('abcde')` doesn't 
create `['abcde']` just as `list(1)` doesn't create `[1]`.

Mel.

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


RE: webapp development in pure python

2011-10-25 Thread Sells, Fred
Quixote may be what you want, but it's been years since I've used it and
I don't know if it is still alive and kicking.  It was from MEMS if I
remember correctly.

Using django and Flex is one way to avoid html and javascript and it
works great for datagrids.

Fred.

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


Re: webapp development in pure python

2011-10-25 Thread alex23
Laszlo Nagy gand...@shopzeus.com wrote:
 My Python module would connect to a database server and query
 some data, then display it in a grid. This cannot be compiled into
 javascript because of the database server connection.

So what you want is for everything to happen server-side, with html
output sent to the client?

Perhaps you could build on top of ToscaWidgets. They encapsulate HTML
 JS, so you'll still need to work with them for custom widgets.

 With pyjamas, I
 would have to create the server side part separately, the user interface
 separately, and hand-code the communication between the widets and the
 server side.

That's pretty much true of all non-trivial web development, though.

There's a lot to be said for sucking it up and embracing traditional
methods rather than flying against common wisdom and cobbling together
something that works against web technologies rather than with them.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue13251] Update string description in datamodel.rst

2011-10-25 Thread Roundup Robot

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

New changeset 11d18ebb2dd1 by Ezio Melotti in branch 'default':
#13251: update string description in datamodel.rst.
http://hg.python.org/cpython/rev/11d18ebb2dd1

--
nosy: +python-dev

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



[issue13251] Update string description in datamodel.rst

2011-10-25 Thread Ezio Melotti

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


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

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



[issue13248] deprecated in 3.2, should be removed in 3.3

2011-10-25 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Maybe a 2to3 fixer to convert the names should be added?

--

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



[issue13238] Add shell command helpers to shutil module

2011-10-25 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Considering this further, I've realised that the idea of implicit quoting for 
this style of helper function is misguided on another level - the parameters to 
be interpolated may not even be strings yet, so attempting to quote them would 
fail:

 subprocess.call(exit {}.format(1), shell=True)
1
 shlex.quote(1)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/ncoghlan/devel/py3k/Lib/shlex.py, line 285, in quote
if _find_unsafe(s) is None:
TypeError: expected string or buffer

I'll note that none of these problems will be unique to the new convenience API 
- they're all a general reflection of the impedance mismatch between typical 
shell interfaces and filenames that can contain spaces.

--

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Manuel de la Pena

Manuel de la Pena man...@canonical.com added the comment:

Indeed, in our code we had to write a number of wrappers around the os calls to 
be able to work with long path on Windows. At the moment working with long 
paths on windows and python is broken in a number of places and is a PITA to 
work with.

--

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



[issue13261] time.clock () has very low resolution on Linux

2011-10-25 Thread Elijah Merkin

New submission from Elijah Merkin e...@transas.com:

time.clock () has very poor time resolution on Linux (tested on Ubuntu 11.04).

The result of call to clock () changes once per several seconds. On the other 
side, on Windows it provides very good resolution.

Here is a doctest that fails on Linux:

  from time import sleep
  prev = clock ()
  res = True
  for i in xrange(10):
 ... sleep(0.15)
 ... next = clock ()
 ... res = res and (next - prev)  0.1
 ... prev = next
  print res
 True


Currently on Linux I am using a workaround that is attached to the issue.

--
components: None
files: monotime_unix.py
messages: 146347
nosy: ellioh
priority: normal
severity: normal
status: open
title: time.clock () has very low resolution on Linux
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file23515/monotime_unix.py

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



[issue13261] time.clock () has very low resolution on Linux

2011-10-25 Thread STINNER Victor

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

This issue is a duplicate of the issue #10278.

--
nosy: +haypo
resolution:  - duplicate
status: open - closed

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



[issue10278] add time.wallclock() method

2011-10-25 Thread STINNER Victor

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

The issue #13261 has been marked as a duplicate of this issue. Copy of 
msg146347:
-
time.clock () has very poor time resolution on Linux (tested on Ubuntu 11.04).

The result of call to clock () changes once per several seconds. On the other 
side, on Windows it provides very good resolution.

Here is a doctest that fails on Linux:

  from time import sleep
  prev = clock ()
  res = True
  for i in xrange(10):
 ... sleep(0.15)
 ... next = clock ()
 ... res = res and (next - prev)  0.1
 ... prev = next
  print res
 True


Currently on Linux I am using a workaround that is attached to the issue.
-

The issue has also a script:
http://bugs.python.org/file23515/monotime_unix.py

--

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Antoine Pitrou

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

Thanks for the patch. Is there a reason you don't use shutil.rmtree in 
tearDown()?
I don't know if it's our business to convert forward slashes passed by the 
user. Also, general support for extended paths is another can of worms ;)

--

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



[issue10278] add time.wallclock() method

2011-10-25 Thread Antoine Pitrou

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

CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are 
optional according to POSIX, which only mandates CLOCK_REALTIME. You should 
mention it in the docs.

You might also want to export clock_getres():
http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html

--

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



[issue13218] test_ssl failures on Debian/Ubuntu

2011-10-25 Thread Antoine Pitrou

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

 It looks like it's been this way for a long time too.

But tests have always passed here using OpenSSL 1.0.0.

 It's probably too difficult, and not really Python's responsibility,
 to determine whether SSL_OP_NO_SSLv2 is set.

See http://docs.python.org/dev/library/ssl.html#ssl.SSLContext.options

 Rather, I think the test is simply bogus and should be disabled or
 removed.

I think it would be good to keep a simplified/minimal (and, of course,
working :-)) version of these tests.
Patches welcome, anyway. I can't really test with Debian's OpenSSL.

--

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Manuel de la Pena

Manuel de la Pena man...@canonical.com added the comment:

In case of my patch (I don't know about santa4nt case) I did not use 
shutil.remove because it was not used in the other tests and I wanted to be 
consistent and not add a new import. Certainly if there is not an issue with 
that we should use it.

--

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



[issue13262] IDLE opens partially hidden

2011-10-25 Thread Aivar Annamaa

New submission from Aivar Annamaa aivar.anna...@gmail.com:

When IDLE opens in Windows 7, its bottom edge will be hidden behind taskbar. It 
should position itself so that it's fully visible.

--
components: IDLE
messages: 146354
nosy: Aivar.Annamaa
priority: normal
severity: normal
status: open
title: IDLE opens partially hidden
type: behavior
versions: Python 3.2

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



[issue10278] add time.wallclock() method

2011-10-25 Thread Roundup Robot

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

New changeset 35e4b7c4bafa by Victor Stinner in branch 'default':
Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
http://hg.python.org/cpython/rev/35e4b7c4bafa

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue10278] add time.wallclock() method

2011-10-25 Thread STINNER Victor

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

I closed maybe this issue too quickly. My commit doesn't solve the initial 
issue: Python doesn't provide a portable wallclock function.

wallclock.patch should be updated to use:

 - time.clock() on Windows (use QueryPerformanceCounter)
 - or time.clock_gettime(CLOCK_MONOTONIC_RAW) if available
 - or time.clock_gettime(CLOCK_MONOTONIC) if available
 - or time.time() (which is usually gettimeofday())

Pseudo-code:

wallclock = None
if hasattr(time, 'clock_gettime') and hasattr(time, 'CLOCK_MONOTONIC_RAW'):
  # I understood that CLOCK_MONOTONIC_RAW is more reliable
  # than CLOCK_MONOTONIC, because CLOCK_MONOTONIC may be adjusted
  # by NTP. I don't know if it's correct.
  def wallclock():
return time.clock_gettime(CLOCK_MONOTONIC_RAW)

elif hasattr(time, 'clock_gettime') and hasattr(time, 'CLOCK_MONOTONIC'):
  def wallclock():
return time.clock_gettime(CLOCK_MONOTONIC)

elif os.name == 'nt':
  # define a new function to be able to set its docstring
  def wallclock():
return time.clock()

else:
  def wallclock():
 return time.time()
if wallclock is not None:
   wallclock.__doc__ = 'monotonic time'
else:
   del wallclock

wallclock() doc should also explain that time.time() may be adjusted by NTP or 
manually by the administrator.

--

By the way, it would be nice to expose the precision of time.clock(): it's 
1/divisor or 1/CLOCKS_PER_SEC on Windows, 1/CLOCKS_PER_SEC on UNIX.

--
resolution: fixed - 
status: closed - open

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



[issue13218] test_ssl failures on Debian/Ubuntu

2011-10-25 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

On Oct 25, 2011, at 09:56 AM, Antoine Pitrou wrote:


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

 It looks like it's been this way for a long time too.

But tests have always passed here using OpenSSL 1.0.0.

Right, sorry, what I meant was this particular behavior (switching to SSLv3
client hello when SSLv2 is disabled) appears to have been in upstream openssl
since about 2005.  What's changed recently is that instead of patching openssl
to disable SSLv2 (and thereby not triggering the client hello switch), Debian
has started to use the no-ssl Configure option, which is what probably started
allowing this test to unexpectedly succeed.

 It's probably too difficult, and not really Python's responsibility,
 to determine whether SSL_OP_NO_SSLv2 is set.

See http://docs.python.org/dev/library/ssl.html#ssl.SSLContext.options

Interesting, thanks for the pointer.

 Rather, I think the test is simply bogus and should be disabled or
 removed.

I think it would be good to keep a simplified/minimal (and, of course,
working :-)) version of these tests.
Patches welcome, anyway. I can't really test with Debian's OpenSSL.

I'll work up a patch.

-Barry

--

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



[issue13226] Expose RTLD_* constants in the posix module

2011-10-25 Thread Roundup Robot

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

New changeset c75427c0da06 by Victor Stinner in branch 'default':
Issue #13226: Add RTLD_xxx constants to the os module. These constants can by
http://hg.python.org/cpython/rev/c75427c0da06

--
nosy: +python-dev

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



[issue13226] Expose RTLD_* constants in the posix module

2011-10-25 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
resolution:  - fixed
status: open - closed

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



[issue12619] Automatically regenerate platform-specific modules

2011-10-25 Thread Roundup Robot

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

New changeset 6159311f0f44 by Victor Stinner in branch 'default':
Issue #12619: Expose socket.SO_BINDTODEVICE constant
http://hg.python.org/cpython/rev/6159311f0f44

--

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



[issue13256] Document and test new socket options

2011-10-25 Thread STINNER Victor

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

For #12619, I added socket.SO_BINDTODEVICE constant.

--

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



[issue9750] sqlite3 iterdump fails on column with reserved name

2011-10-25 Thread Lucas Sinclair

Lucas Sinclair blastoc...@mac.com added the comment:

I just encountered this issue today.

So, it's been several months, will the patch be merged into the master branch ? 
Or will this never be fixed ?

--
nosy: +xapple

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Ezio Melotti

New submission from Ezio Melotti ezio.melo...@gmail.com:

In Python 3.3 the os module gained a few new functions and constants:

Python 3.2.2+ (3.2:58a75eeb5c8e, Sep 29 2011, 02:11:05) 
 import os; len(dir(os))
232

Python 3.3.0a0 (default:a50f080c22ca+, Oct 25 2011, 09:56:01) 
 import os; len(dir(os))
332

http://docs.python.org/dev/py3k/whatsnew/3.3.html#os lists some of these 
additions, and they are already grouped (e.g. the sched_* functions, the at 
functions, ...).

Before the os API gets even more bloated, maybe we should group some of these 
functions in new submodules, like os.sched.*.

--
components: Extension Modules
messages: 146363
nosy: benjamin.peterson, ezio.melotti, georg.brandl, loewis, pitrou, rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: Group some os functions in submodules
type: feature request
versions: Python 3.3

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



[issue10197] subprocess.getoutput fails on win32

2011-10-25 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Without knowing this issue existed, I recently started working on adding some 
convenience APIs for shell invocation to shutil: 
http://bugs.python.org/issue13238

I think the getstatus and getstatusoutput APIs were copied from the commands 
module in 3.0 without sufficient thought being given to whether or not they fit 
with the design principles of the subprocess module. IMO, both should be 
deprecated:
   - they're not cross-platform
   - they invoke the shell implicitly, which subprocess promises never to do

--
nosy: +ncoghlan

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



[issue13238] Add shell command helpers to shutil module

2011-10-25 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

I discovered a couple of APIs that were moved from the commands module to the 
subprocess module in 3.0:
http://docs.python.org/dev/library/subprocess#subprocess.getstatusoutput

However, they have issues, especially on Windows: 
http://bugs.python.org/issue10197

So part of this patch would include deprecating those two interfaces in favour 
of the new shutil ones - the existing APIs break the subprocess promise of 
never invoking the shell implicitly.

--

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +haypo

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue13256] Document and test new socket options

2011-10-25 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
keywords: +patch
Added file: http://bugs.python.org/file23516/socket_options_doc.patch

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Ross Lagerwall

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


--
nosy: +rosslagerwall

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



[issue13264] Monkeypatching using metaclass

2011-10-25 Thread Artem Tomilov

New submission from Artem Tomilov scrapl...@gmail.com:

from abc import ABCMeta

class Meta(ABCMeta):
def __instancecheck__(cls, instance):
# monkeypatching class method
cls.__subclasscheck__ = super(Meta, cls).__subclasscheck__
return super(Meta, cls).__instancecheck__(instance)

def __subclasscheck__(cls, sub):
return cls in sub.mro()

class A(object):
__metaclass__ = Meta

class B(object): pass

# registering class 'B' as a virtual subclass of 'A'
A.register(B)

 issubclass(B, A)
False
 isinstance(B(), A) # = method __subclasscheck__ is now monkeypatched
True
 issubclass(B, A) # = desire to get 'True' because 'B' is a virtual subclass
False

--
components: None
messages: 146366
nosy: Artem.Tomilov
priority: normal
severity: normal
status: open
title: Monkeypatching using metaclass
type: behavior
versions: Python 2.7

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



[issue13238] Add shell command helpers to shutil module

2011-10-25 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

After a bit of thought, I realised I could use the string.Formatter API to 
implement a custom formatter for the shell command helpers that auto-escapes 
whitespace while leaving the other shell metacharacters alone (so you can still 
interpolate paths containing wildcards, etc).

People that want to bypass the autoescaping of whitespace can do the 
interpolation prior to the shell call, those that also want to escape shell 
metacharacters can use shlex.quote explicitly.

Diff can be seen here:
https://bitbucket.org/ncoghlan/cpython_sandbox/changeset/f19accc9a91b

--
hgrepos: +85

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



[issue13264] Monkeypatching using metaclass

2011-10-25 Thread Ezio Melotti

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


--
nosy: +ezio.melotti

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



[issue13220] print function unable while multiprocessing.Process is being run

2011-10-25 Thread ben

ben thelen_...@yahoo.com added the comment:

Thanks Terry,

That does solve the problem, so the bug is really with IDLE (I got a previous 
Issue (12967) reported which also was connected to the stdout).

I changed the component to IDLE as the lib. is working as it should do.

--
components: +IDLE -Library (Lib)

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



[issue8036] Interpreter crashes on invalid arg to spawnl on Windows

2011-10-25 Thread Vetoshkin Nikita

Vetoshkin Nikita nikita.vetosh...@gmail.com added the comment:

against py3k branch?

--

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



[issue8036] Interpreter crashes on invalid arg to spawnl on Windows

2011-10-25 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Now we are using Mercurial, and what was called 'py3k' on SVN is now 'default'. 
 Since we now commit on older branches first and then merge with the most 
recent ones, the patch should either be against 3.2 or 2.7.
You can check the devguide for more informations.

--
nosy: +ezio.melotti

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



[issue13258] replace hasattr(obj, '__call__') with callable(obj)

2011-10-25 Thread Éric Araujo

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

This change is fine for packaging.  In the 2.x backport I already use callable 
(and damn the py3k warning) and  the 3.x backport uses the incorrect 
hasattr(inst, '__call__'); I’ll change that to use a backported 
d2.compat.callable.

--

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



[issue12618] py_compile cannot create files in current directory

2011-10-25 Thread Éric Araujo

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

I can reproduce in 3.2 and 3.3.  I’ll commit a test and patch when I get the 
time, or another dev can take this over.

--

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



[issue13260] distutils and cross-compiling the extensions

2011-10-25 Thread Éric Araujo

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

Hi Alexander,

Thanks for your interest in improving Python.  I’m forced to reject your 
request because

- Python 2.7 does not get new features (and support for cross-compilation would 
be one).

- distutils does not get new features (we had to freeze it because improvements 
broke many setup scripts depending on undocumented behavior or working around 
bugs).

- This request has been made many times already: 
http://mail.python.org/pipermail/python-dev/2011-March/110099.html

To get cross-compilation, here’s one would have to do:

- Work on distutils2, the replacement for distutils and setuptools (it’s 
included in Python 3.3 under the “packaging” name).

- Define exactly what is supported (cross-compiling from any platform to any 
platform for example), possibly by reviewing all other bug reports about and 
hashing things out on the distutils-sig mailing list.

- Think about getting buildbots running to make sure we don’t get regressions.

--
assignee: tarek - eric.araujo
resolution:  - rejected
stage:  - committed/rejected
status: open - closed

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



[issue9750] sqlite3 iterdump fails on column with reserved name

2011-10-25 Thread Éric Araujo

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

Hi Lucas.  Have you read my previous message?  The patch needs to be updated.  
Would you like to do it?

--
versions: +Python 3.3 -Python 3.1

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Santoso Wijaya

Santoso Wijaya santoso.wij...@gmail.com added the comment:

Even if we decide not to convert any forward slash, listdir() adds u\\*.* 
when the input is unicode, but it adds /*.* when it is not, before passing it 
off to Windows API. Hence the inconsistency and the problem Manuel saw.

IMO, his patch shouldn't have differentiated if the path starts with r\\?\ 
and just be consistent with adding \\*.*, unicode or not.

--

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



[issue13240] sysconfig gives misleading results for USE_COMPUTED_GOTOS

2011-10-25 Thread Éric Araujo

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

 If we truly want to enable this by default, then the defaulting should be 
 moved to
 configure.  This will give a more accurate portrayal in sysconfig.
This sounds good.  (I know little about configure/pyconfig.h, but making 
sysconfig more accurate is a valuable result.)

 P.S. We could probably get rid of the HAVE macro all together by doing
 all the work in the 'configure' script.
Would that be a breach of backward compatibility for sysconfig?

--

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



[issue13244] WebSocket schemes in urllib.parse

2011-10-25 Thread Éric Araujo

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

 # must always be escaped, both in path and query components.

Agreed.  This just follows from the Generic URI Syntax RFC, it’s not specific 
to WebSockets.

 And further: urlparse should raise an exception upon unescaped # within URLs
 from ws/wss schemes.

I’d say that urlparse should raise an exception when a ws/wss URI contains a 
fragment part.  I’m not sure this will be possible; from a glance at the source 
and a quick test, urlparse will happily break the Generic URI Syntax RFC and 
return a path including a # character!

--
title: WebSocket schemes in urlparse - WebSocket schemes in urllib.parse

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



[issue12394] packaging: generate scripts from callable (dotted paths)

2011-10-25 Thread Éric Araujo

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

 What about Windows support?
Just like with distutils: the file extension is used, not the shebang.

--

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



[issue10197] subprocess.getoutput fails on win32

2011-10-25 Thread Éric Araujo

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

 IMO, both should be deprecated:
 - they're not cross-platform
Isn’t the purpose of this report to fix that? :)

 - they invoke the shell implicitly, which subprocess promises never to do
One could argue that it’s not implicit if it’s documented.  Nonetheless, I 
agree that they don’t fit well with the subprocess promises.

So, +1 on deprecating and +1 on new, safer helpers.

--

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



[issue13218] test_ssl failures on Debian/Ubuntu

2011-10-25 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

I'm not sure I particularly like this patch, and I can't test it on anything 
other than Debian/Ubuntu right now, but it does fix the test (defined as: 
making it pass :).

AFAICT, there's no way to tell openssl to revert back to trying SSLv2 client 
hello when the library has been compiled with no-ssl, but still setting 
OP_NO_SSLv2 or OP_NO_TLSv1 kind of seems like keeping a couple of tests that 
can't possibly succeed (because neither v2 nor v3, nor tlsv1 will be tried).

The other thing is that testing the flags on the client context doesn't seem to 
work:


Python 3.2.2+ (3.2:03ef6108beae, Oct 25 2011, 10:57:32) 
[GCC 4.6.1] on linux2
Type help, copyright, credits or license for more information.
 import ssl
 cc = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
 cc.options  ssl.OP_NO_SSLv2
0

Now, the other way to go is to set OP_NO_SSLv2 on both tests and change the 
sense of it from False to True, so that we'd always expect the connection to 
succeed.  I'll attach that patch next, and it does seem a bit more sane.  Let 
me know what you think.

--
Added file: http://bugs.python.org/file23517/issue13218.diff

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



[issue13218] test_ssl failures on Debian/Ubuntu

2011-10-25 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

Here's the diff that disables SSLv2 and changes the expected sense of the 
connection results.  Again, I can't test this on other than Debian/Ubuntu atm, 
so feedback would be useful.

--
Added file: http://bugs.python.org/file23518/issue13218-true.diff

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



[issue12394] packaging: generate scripts from callable (dotted paths)

2011-10-25 Thread Vinay Sajip

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

 

  What about Windows support?
 Just like with distutils: the file extension is used, not the shebang.

Please spell out for me how you see this working: I don't see it. Note that 
scripts have to use the correct Python even if they are invoked using an 
explicit path pointing into a virtual environment.

--

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



[issue12394] packaging: generate scripts from callable (dotted paths)

2011-10-25 Thread Vinay Sajip

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

To expand on what I said about not seeing how things will work under Windows: 
are we going to place .exe launchers adjacent to the script, like setuptools 
does? If the script just has a shebang of #!/usr/bin/env python, how is the 
launcher supposed to determine the exact Python to use from that, in a venv 
scenario where multiple Pythons will be installed? Scripts in virtual envs are 
supposed to run if invoked, even if the env is not on the PATH.

--

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



[issue12641] Remove -mno-cygwin from distutils

2011-10-25 Thread Seppo Yli-Olli

Seppo Yli-Olli seppo.ylio...@gmail.com added the comment:

Would it be practical to have a trivial compilation test to see if we are 
capable of using GCC with -mno-cygwin and if so, use it, otherwise drop off? I 
think GNU autotools uses a similar strategy for detecting compiler capabilities.

--
nosy: +Seppo.Yli-Olli

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



[issue13017] pyexpat.c: refleak

2011-10-25 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

The patch is not correct: modelobj must not be decref'd, because it has been 
inserted to the args tuple with the reference-stealing 'N' format. args is 
later decref'd in function's cleanup code after finally:.

--
keywords:  -after moratorium
resolution:  - rejected
stage: patch review - committed/rejected
status: open - closed

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Martin v . Löwis

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

I think there is a value to use the very same function names in the posix 
module as in the posix API. The posix API (and C in general) is also flat, and 
uses the prefix convention. People who look at the function lists will know to 
ignore blocks of functions by prefix if they don't need them.

--

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



[issue13016] selectmodule.c: refleak

2011-10-25 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

PySequence_Fast_GET_ITEM expects that the object is valid and the index is 
within bounds, and never returns NULL. There's no need to decref and actually 
there's even no need to check the return value of PySequence_Fast_GET_ITEM.

--
resolution:  - rejected
stage: patch review - committed/rejected
status: open - closed

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Martin v . Löwis

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

This issue is getting messy. I declare that this issue is *only* about the 
original problem reported in msg146031. When that is fixed, this issue will be 
closed, and any further issues need to be reported separately.

As for the original problem, ISTM that the right fix is to replace

namebuf[len++] = '/';

with

namebuf[len++] = '\\';

No further change should be necessary.

--

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Santoso Wijaya

Santoso Wijaya santoso.wij...@gmail.com added the comment:

Addressing patch comments.

--
Added file: http://bugs.python.org/file23519/issue13234_py33_v3.patch

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Of the new ones, only the sched_* ones share a common prefix, the *xattr and 
*at functions share a common suffix, and it's difficult to find them e.g. in 
dir() (also it's difficult to find other common os functions among all the 
names).  The fact that the Posix API and C in general use a flat API doesn't 
seem to me a valid reason to do the same in Python.  Having the same name is a 
good reason to avoid sched.*, even if I don't think that having sched.* will 
make finding/recognizing these functions much more difficult.

--

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Santoso Wijaya

Santoso Wijaya santoso.wij...@gmail.com added the comment:

Fair enough. Simplifying.

--
Added file: http://bugs.python.org/file23520/issue13234_py33_v4.patch

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Charles-François Natali

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

 I think there is a value to use the very same function names in the 
 posix module as in the posix API.

It would still be the case, except that they'd live in distinct submodule.

 The posix API (and C in general) is also flat, and uses the prefix 
 convention.

That's because C doesn't have namespaces: it's certainly due to this 
limitation, and not a design choice (and when you think about it, there is a 
namespace hierarchy, in the header files: sys/sched.h, attr/xatr.h, etc.).

--
nosy: +neologix

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



  1   2   >