[Ann] Cobra 2.5 - Windows GUI test automation tool

2012-10-05 Thread Nagappan Alagappan
Hello,

Highlights

* Added Perl interface (Contributed by xsawyerx)
* Added parallel execution (Leaks memory though, its not default, set
LDTP_PARALLEL_MEM_LEAK environment variable before starting test)
* Added new APIs (rightclick)
* Fixed multiple bugs reported by users

Credit:

* Sawyer X (Perl LDTP library)
* VMware colleagues
* Wold (IRC)
* Thanks to all others who have reported bugs through forum / email /
in-person / IRC

Please spread the word and also share your feedback with us (email me:
nagap...@gmail.com).

About LDTP:

Cross Platform GUI Automation tool Linux version is LDTP, Windows version
is Cobra and Mac version is PyATOM (Work in progress).

* Linux version is known to work on GNOME / KDE (QT = 4.8) / Java Swing /
LibreOffice / Mozilla application on all major Linux distribution.
* Windows version is known to work on application written in .NET / C++ /
Java / QT on Windows XP SP3 / Windows 7 / Windows 8 development version.
* Mac version is currently under development and verified only on OS X
Lion/Mountain Lion. Where ever PyATOM runs, LDTP should work on it.

Download source: https://github.com/ldtp/cobra

Download binary (Windows XP / Windows 7 / Windows 8):
https://github.com/ldtp/cobra/downloads
System requirement: .NET 3.5, refer README.txt after installation

Documentation references:

For detailed information on LDTP framework and latest updates visit
 http://ldtp.freedesktop.org

For information on various APIs in LDTP including those added for this
release can be got from http://ldtp.freedesktop.org/user-doc/index.html
Java doc - http://ldtp.freedesktop.org/javadoc/

Report bugs - http://ldtp.freedesktop.org/wiki/Bugs

To subscribe to LDTP mailing lists, visit
http://ldtp.freedesktop.org/wiki/Mailing_20list

IRC Channel - #ldtp on irc.freenode.net

Thanks
Nagappan

-- 
Linux Desktop (GUI Application) Testing Project -
http://ldtp.freedesktop.org
Cobra - Windows GUI Automation tool - https://github.com/ldtp/cobra
http://nagappanal.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: How can I hide my stack frames in a TestCase subclass?

2012-10-05 Thread Manuel Pégourié-Gonnard
Peter Otten scripsit :

 David Banks wrote:

 Note that the custom assert method causes a stack trace with two frames,
 one inside the method itself, whereas the stock unittest method only has
 one frame, the relevant line in the user's code.  How can I apply this
 frame-hiding behaviour to my own method?

 Move MyTestCase in a separate module and define a global variable 

 __unittest = True

Hum, is it documented somewhere? I can't find it in the doc. Also, I'm
curious to know what kind of magic it's using.

-- 
Manuel Pégourié-Gonnard - http://people.math.jussieu.fr/~mpg/


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


Reading properties file in Python, except using ConfigParser()

2012-10-05 Thread justmailharsh
Hi All,

How to read properties file in Python? I found ConfigParser() but it has a 
'section' limitation, so looking for other alternatives.

Thanks,

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


How to create a login screen using core python language without using any framework

2012-10-05 Thread shivakrshn49
I need to develop a simple login page using Python language with two fields and 
a button, like:

Username, Password, Login

I know there are some beautiful Python frameworks like

Django, Grok, WebPy, TurboGears

which support web development using Python, but mine is a basic requirement 
consisting of only 3 screens (pages): 

* 1st page  -  Login page (Redirects to 2nd page when login button is clicked) 
* 2nd page  -  Page with records in the form of a list, with an option for 
adding new records (Redirects to 3rd page when Add Records button is clicked)
* 3rd page  -  Page with fields, which are saved as records for the list on 2nd 
page  (After entering details and clicking Submit)

So, I have decided to develop the above functionality using Python **without** 
using any framework, so that I can have flexibility as well as write my own 
code. 

1. Is it possible to create a login page using Python without using a framework?

2. I haven't worked on web services and don't know the basics of web 
development in Python.

3. If possible, can you provide me an example on how to create a login page 
using Python and achieve the functionality described above?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading properties file in Python, except using ConfigParser()

2012-10-05 Thread Laszlo Nagy

On 2012-10-05 09:20, justmailha...@gmail.com wrote:

Hi All,

How to read properties file in Python? I found ConfigParser() but it has a 
'section' limitation, so looking for other alternatives.

http://wiki.python.org/moin/ConfigParserShootout

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


Re: final question: logging to stdout and updating files

2012-10-05 Thread Mark Lawrence

On 04/10/2012 15:27, Chris Angelico wrote:

ensured that Australia won the next Test Match

ChrisA
may need to schedule surgical detongueing of his cheek



I'll arrange the cheek detonguing very cheaply after a comment like that :)

--
Cheers.

Mark Lawrence.

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


Re: How can I hide my stack frames in a TestCase subclass?

2012-10-05 Thread Peter Otten
Manuel Pégourié-Gonnard wrote:

 Peter Otten scripsit :
 
 David Banks wrote:

 Note that the custom assert method causes a stack trace with two frames,
 one inside the method itself, whereas the stock unittest method only has
 one frame, the relevant line in the user's code.  How can I apply this
 frame-hiding behaviour to my own method?

 Move MyTestCase in a separate module and define a global variable

 __unittest = True

 Hum, is it documented somewhere? I can't find it in the doc. Also, I'm
 curious to know what kind of magic it's using.

I took advantage of the fact that Python is open source and had a look into 
the source code ;)

$ cd /usr/lib/python2.7/unittest
$ grep frame *.py -C2
...
result.py-
result.py-def _is_relevant_tb_level(self, tb):
result.py:return '__unittest' in tb.tb_frame.f_globals
result.py-
...

$ grep _is_relevant_tb_level *.py -C5
result.py-
result.py-def _exc_info_to_string(self, err, test):
result.py-Converts a sys.exc_info()-style tuple of values into a 
string.
result.py-exctype, value, tb = err
result.py-# Skip test runner traceback levels
result.py:while tb and self._is_relevant_tb_level(tb):
result.py-tb = tb.tb_next
result.py-
...

And so on. I actually used an editor, not grep -- but you get the idea.

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


Re: How to create a login screen using core python language without using any framework

2012-10-05 Thread Сахнов Михаил
Hi, you can write a simple wsgi app for that, and run it through simple
server, for example.

http://docs.python.org/library/wsgiref.html
05.10.2012 12:06 пользователь shivakrsh...@gmail.com написал:

 I need to develop a simple login page using Python language with two
 fields and a button, like:

 Username, Password, Login

 I know there are some beautiful Python frameworks like

 Django, Grok, WebPy, TurboGears

 which support web development using Python, but mine is a basic
 requirement consisting of only 3 screens (pages):

 * 1st page  -  Login page (Redirects to 2nd page when login button is
 clicked)
 * 2nd page  -  Page with records in the form of a list, with an option for
 adding new records (Redirects to 3rd page when Add Records button is
 clicked)
 * 3rd page  -  Page with fields, which are saved as records for the list
 on 2nd page  (After entering details and clicking Submit)

 So, I have decided to develop the above functionality using Python
 **without** using any framework, so that I can have flexibility as well as
 write my own code.

 1. Is it possible to create a login page using Python without using a
 framework?

 2. I haven't worked on web services and don't know the basics of web
 development in Python.

 3. If possible, can you provide me an example on how to create a login
 page using Python and achieve the functionality described above?
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: final question: logging to stdout and updating files

2012-10-05 Thread Mark Lawrence

On 04/10/2012 23:36, Prasad, Ramit wrote:


Python is a product for Americans! ;) It should ensure America
wins the Test Matchwait, do we even have a cricket team?


ChrisA could have been talking rugby, your rugby union team isn't't too 
bad for a bunch of amateurs, some of whom had to take unpaid leave to 
play in the world cup.  I don't think there's any rugby league sides in 
the USA.  Then there's speedway and...?






Optimization really is that important, folks!

ChrisA
may need to schedule surgical detongueing of his cheek


Think we could get a group rate for c.l.p?


I'm sure that with some appropriate grovelling the PSF could arrange 
this.  Perhaps fly everybody to the UK for PyCon and get the surgery 
done on the NHS at the same time.




Ramit



--
Cheers.

Mark Lawrence.

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


Re: How to print html in python the normal way

2012-10-05 Thread ashishjain . ash
Hi,

Thanks for the reply.
Apologies for my question not clear. Yes I am using django framework for it.

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


Re: notmm is dead!

2012-10-05 Thread Ramchandra Apte
On Thursday, 4 October 2012 23:40:47 UTC+5:30, Etienne Robillard  wrote:
 Dear list,
 
 
 
 Due to lack of energy and resources i'm really sad to announce the removal of 
 notmm from pypi and bitbucket. I deleted
 
 also my account from bitbucket as it was not really useful for me. notmm will 
 continue to be accessible from my master
 
 site at http://gthc.org/dist/notmm until the server get down, as I cannot 
 find money to pay for the hosting of notmm.org,
Can't you use Google Code?
 
 neither anyone to encourage the project so it can grow further.  
 
 
 
 I have tried to develop a coherent extension for Django using the open source 
 model but I'm afraid to have been
 
 bitten by its failure to encourage a free market over one dictated by profit 
 and the use of cheap tricks to compete unfairly
 
 with perhaps too much openness. I always will also continue to love and use 
 free softwares but sadly it seems asking for a little
 
 fairness is too much asked to competitors dedicated in stealing and 
 subverting my work for their own advantages...
 
 
 
 I therefore refuse to continue any longer being mocked by competitors asking 
 excessive prices for having a broken Internet dictated by
 
 a few companies and decide the content I should be visiting. 
 
 
 
 Shall you have anything you wish saying I'll be open to discuss further on 
 this list. I wish also to thanks the supporters
 
 of the project who have invested time and energy into my business and 
 dedication to the notmm project. 
 
 
 
 Best wishes,
 
 
 
 Etienne 
 
 
 
 -- 
 
 Etienne Robillard
 
 Green Tea Hackers Club
 
 Fine Software Carpentry For The Rest Of Us!
 
 http://gthc.org/
 
 e...@gthcfoundation.org
 
 
 
 If a free society cannot help the many who are poor, it cannot save the few 
 who are rich. -John F. Kennedy

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


Re: sum function

2012-10-05 Thread Ramchandra Apte
On Friday, 5 October 2012 07:31:24 UTC+5:30, Mike  wrote:
 I agree with you, Ian. Thanks for all the help.  Now I get the below error.
 
 
 
   File test.py, line 17, in module
 
 total = sum(float(col.value) for r in iter(next_r, None) for col in 
 r[0].columns.itervalues())
 
   File test.py, line 17, in genexpr
 
 total = sum(float(col.value) for r in iter(next_r, None) for col in 
 r[0].columns.itervalues())
 
 
 
 Thanks

You have missed the last line of the traceback (error)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can I hide my stack frames in a TestCase subclass?

2012-10-05 Thread Manuel Pégourié-Gonnard
Peter Otten scripsit :

 Manuel Pégourié-Gonnard wrote:

 Peter Otten scripsit :
 
 __unittest = True

 Hum, is it documented somewhere? I can't find it in the doc. Also, I'm
 curious to know what kind of magic it's using.

 I took advantage of the fact that Python is open source and had a look into 
 the source code ;)

Fair enough.

However, there was an implied question in the documented part: can
we rely on it? Isn't it considered an implementation detail (names
starting with underscores)?

 $ cd /usr/lib/python2.7/unittest
 $ grep frame *.py -C2
 ...
 result.py-
 result.py-def _is_relevant_tb_level(self, tb):
 result.py:return '__unittest' in tb.tb_frame.f_globals
 result.py-
 ...

 $ grep _is_relevant_tb_level *.py -C5
 result.py-
 result.py-def _exc_info_to_string(self, err, test):
 result.py-Converts a sys.exc_info()-style tuple of values into a 
 string.
 result.py-exctype, value, tb = err
 result.py-# Skip test runner traceback levels
 result.py:while tb and self._is_relevant_tb_level(tb):
 result.py-tb = tb.tb_next
 result.py-
 ...

 And so on. I actually used an editor, not grep -- but you get the idea.

Sure, thanks.

-- 
Manuel Pégourié-Gonnard - http://people.math.jussieu.fr/~mpg/


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


error bluetooth

2012-10-05 Thread Luca Sanna
the code is output the error of the ubuntu

from bluetooth import *

target_name = My Phone
target_address = None

nearby_devices = discover_devices()

for address in nearby_devices:
if target_name == lookup_name( address ):
target_address = address
break

if target_address is not None:
print found target bluetooth device with address, target_address
else:
print could not find target bluetooth device nearby

the error

luca@luca-XPS-M1330:~/py-temperature/py-temperature$ python bluetooth.py
Traceback (most recent call last):
  File bluetooth.py, line 14, in module
from bluetooth import *
  File /home/luca/py-temperature/py-temperature/bluetooth.py, line 19, in 
module
nearby_devices = discover_devices()
NameError: name 'discover_devices' is not defined
luca@luca-XPS-M1330:~/py-temperature/py-temperature$ 

it's a bug of the module? thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: + in regular expression

2012-10-05 Thread Duncan Booth
Cameron Simpson c...@zip.com.au wrote:

 On 03Oct2012 21:17, Ian Kelly ian.g.ke...@gmail.com wrote:
| On Wed, Oct 3, 2012 at 9:01 PM, contro opinion
| contropin...@gmail.com wrote: 
|  why the  \s{6}+  is not a regular pattern?
| 
| Use a group: (?:\s{6})+
 
 Yeah, it is probably a precedence issue in the grammar.
 (\s{6})+ is also accepted.

It's about syntax, not precedence, but the documentation doesn't really 
spell it out in full. Like most regex documentation it talks in woolly 
terms about special characters rather than giving a formal syntax.

A regular expression element may be followed by a quantifier. 
Quantifiers are '*', '+', '?', '{n}', '{n,m}' (and lazy quantifiers 
'*?', '+?', '{n,m}?'). There's nothing in the regex language which says 
you can follow an element with two quantifiers. Parentheses (grouping or 
non-grouping) around a regex turn that regex into a single element which 
is why you can then use another quantifier.

In bnf, I think Python's regexes would be somthing like:

re ::= union | simple-re
union ::= re | simple-re
simple-re ::= concatenation | basic-re
concatenation ::= simple-re basic-re
basic-re ::= element | element quantifier
element ::= group | nc-group | . | ^ | $ | char | charset
quantifier = * | + | ? | { NUMBER } | { NUMBER , NUMBER 
} |*? | +? | { NUMBER , NUMBER }?
group ::= ( re )
nc-group ::= (?: re )
char = any non-special character | \ any character

... and so on. I didn't include charsets or all the (?...) extensions or 
special sequences.

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


Re: How can I hide my stack frames in a TestCase subclass?

2012-10-05 Thread Peter Otten
Manuel Pégourié-Gonnard wrote:

 However, there was an implied question in the documented part: can
 we rely on it? Isn't it considered an implementation detail (names
 starting with underscores)?

Not documented was my implied answer.

I think you have a valid use case, though, so you could make a feature 
request for an official way to hide stack frames on the bugtracker 
http://bugs.python.org or the python-ideas mailing list.


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


Re: How to create a login screen using core python language without using any framework

2012-10-05 Thread Hans Mulder
On 5/10/12 10:03:56, shivakrsh...@gmail.com wrote:
 I need to develop a simple login page using Python language with
 two fields and a button, like:
 
 Username, Password, Login
 
 I know there are some beautiful Python frameworks like
 
 Django, Grok, WebPy, TurboGears

 which support web development using Python, but mine is a basic
 requirement consisting of only 3 screens (pages):
 
 * 1st page  -  Login page (Redirects to 2nd page when login button
   is clicked) 
 * 2nd page  -  Page with records in the form of a list, with an
   option for adding new records (Redirects to 3rd page when Add
   Records button is clicked)
 * 3rd page  -  Page with fields, which are saved as records for
   the list on 2nd page  (After entering details and clicking Submit)

Implementing your application using any of those frameworks you
mentioned, would be easy.

 So, I have decided to develop the above functionality using Python
 **without** using any framework, so that I can have flexibility as
 well as write my own code. 

This is a bad idea.  You'll get much more flexibility using
an existing framework then you'd ever achieve by reinventing
the wheel on your own.  Especially if you have no experience
in this field.

 1. Is it possible to create a login page using Python without
 using a framework?

Yes.

But it's a lot of work.  You'd effectively be rewriting all
the functionality you'd get for free with a framework.  And
it wouldn't be as flexible, because frameworks can flex in
directions that you didn't think of.

 2. I haven't worked on web services and don't know the basics of
 web development in Python.

In that case, your chances of success are fairly slim.

 3. If possible, can you provide me an example on how to create a
 login page using Python and achieve the functionality described
 above?

The frameworks you mentioned earlier come with tutorials.
These tutorials contain such examples.

You should really use an existing framework.  Once you're
aware of how much functionality you get out of a framework
(any of them), you wouldn't dream of rewriting all that
functionality on your own.


Hope this helps,

-- HansM





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


Re: error bluetooth

2012-10-05 Thread Ulrich Eckhardt

Am 05.10.2012 10:51, schrieb Luca Sanna:

the code is output the error of the ubuntu

from bluetooth import *


[...]


nearby_devices = discover_devices()


[...]


the error

luca@luca-XPS-M1330:~/py-temperature/py-temperature$ python bluetooth.py
Traceback (most recent call last):
   File bluetooth.py, line 14, in module
 from bluetooth import *
   File /home/luca/py-temperature/py-temperature/bluetooth.py, line 19, in 
module
 nearby_devices = discover_devices()
NameError: name 'discover_devices' is not defined


The module bluetooth doesn't export any function called 
discover_devices(). You could try dir(bluetooth) or help(bluetooth) 
(do that from an interactive prompt) to find out what is in there. I 
don't know why you expect such a function there, if it is mentioned in 
the documentation or example code that would be a bug.


Uli

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


Re: error bluetooth

2012-10-05 Thread Dave Angel
On 10/05/2012 04:51 AM, Luca Sanna wrote:
 the code is output the error of the ubuntu

 from bluetooth import *

 target_name = My Phone
 target_address = None

 nearby_devices = discover_devices()

 for address in nearby_devices:
 if target_name == lookup_name( address ):
 target_address = address
 break

 if target_address is not None:
 print found target bluetooth device with address, target_address
 else:
 print could not find target bluetooth device nearby

 the error

 luca@luca-XPS-M1330:~/py-temperature/py-temperature$ python bluetooth.py
 Traceback (most recent call last):
   File bluetooth.py, line 14, in module
 from bluetooth import *
   File /home/luca/py-temperature/py-temperature/bluetooth.py, line 19, in 
 module
 nearby_devices = discover_devices()
 NameError: name 'discover_devices' is not defined
 luca@luca-XPS-M1330:~/py-temperature/py-temperature$ 

 it's a bug of the module? thanks

Perhaps you named your script bluetooth.py, and thus masked the module
bluetooth.py.  Pick a different name for your own sources.

-- 

DaveA

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


Re: notmm is dead!

2012-10-05 Thread Etienne Robillard
No. All past notmm licenses were and still ARE ISC licensed. The license fee
is simply because I'm shifting into commercial license for new releases, 
including
the newer 0.4.5 version... Pypi was not the authority source for notmm and 
neither anyone can claim the license was left blank, thats once again a form of 
plagiarism. 

Shall anyone is really serious about supporting the work i did then he'll want 
to pay a minimal fee to get
the proper license rights and can contact me off-list if he want to fork a 
branch
to github of google code.

Thanks,

Etienne 


On Thu, 04 Oct 2012 20:39:55 -0600
Michael Torrie torr...@gmail.com wrote:

 On 10/04/2012 05:13 PM, Etienne Robillard wrote:
  Thanks, but I tried all that and don't have much energy for continuing. If 
  you're
  serious about open source then maybe you can forward the thread to 
  django-developers
  and get some fundings to pay for a minimalistic fee to get the project 
  maintained
  by someone else, otherwise I'd prefer sticking with more profitable 
  activities.
 
 Nothing in the existing license prevents someone from taking the latest
 source and posting it back on Pypi as an unmaintained package.  Isn't
 that correct?
 
 What are you referring to when you say minimalistic fee.  Would this
 be a fee you require for transferring copyright assignment?  I know of
 no fee necessary for a new maintainer to take over should one wish to.
 Copyright assignment is not strictly necessary.
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list


-- 
Etienne Robillard
Green Tea Hackers Club
Fine Software Carpentry For The Rest Of Us!
http://gthc.org/
e...@gthcfoundation.org
-- 
http://mail.python.org/mailman/listinfo/python-list


When was the last time you did something for the first time?

2012-10-05 Thread The Matchmaker
What do you want to talk about today?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: When was the last time you did something for the first time?

2012-10-05 Thread Etienne Robillard
Micro$oft :)


On Fri, 5 Oct 2012 04:03:52 -0700 (PDT)
The Matchmaker i.hudo...@gmail.com wrote:

 What do you want to talk about today?
 -- 
 http://mail.python.org/mailman/listinfo/python-list


-- 
Etienne Robillard
Green Tea Hackers Club
Fine Software Carpentry For The Rest Of Us!
http://gthc.org/
e...@gthcfoundation.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: error bluetooth

2012-10-05 Thread Hans Mulder
On 5/10/12 10:51:42, Luca Sanna wrote:

 from bluetooth import *

[..]

 luca@luca-XPS-M1330:~/py-temperature/py-temperature$ python bluetooth.py

When you say from bluetooth import *, Python will find a file
name bluetooth.py and import stuff from that file.  Since your
script happens to be named bluetooth.py, Python will import
your script, thinking it is a module.

 it's a bug of the module?

You've chosen the wrong file name.  Rename your script.


Hope this helps,

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


Re: Reading properties file in Python, except using ConfigParser()

2012-10-05 Thread Günther Dietrich
justmailha...@gmail.com wrote:

How to read properties file in Python? I found ConfigParser() but it has a 
'section' limitation, so looking for other alternatives.

Have a look at PyYAML.



Best regards,

Günther
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: error bluetooth

2012-10-05 Thread Luca Sanna
Il giorno venerdì 5 ottobre 2012 13:33:14 UTC+2, Hans Mulder ha scritto:
 On 5/10/12 10:51:42, Luca Sanna wrote:
 
 
 
  from bluetooth import *
 
 
 
 [..]
 
 
 
  luca@luca-XPS-M1330:~/py-temperature/py-temperature$ python bluetooth.py
 
 
 
 When you say from bluetooth import *, Python will find a file
 
 name bluetooth.py and import stuff from that file.  Since your
 
 script happens to be named bluetooth.py, Python will import
 
 your script, thinking it is a module.
 
 
 
  it's a bug of the module?
 
 
 
 You've chosen the wrong file name.  Rename your script.
 
 
 
 
 
 Hope this helps,
 
 
 
 -- HansM



i'm sorry, it's ok the rename file in bt.py

how do I send a ping in bluetooth?
because android phones are not always visible.
I can not find the ping command
thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-05 Thread Edward Diener

On 10/1/2012 1:32 PM, Dennis Lee Bieber wrote:

On Sun, 30 Sep 2012 23:06:04 -0400, Edward Diener
eldiener@tropicsoft.invalid declaimed the following in
gmane.comp.python.general:



My thought is a program distributed by Python which finds the versions
of Python on an OS, lets the end-user choose which version should be
invoked when Python is invoked, and does whatever is necessary to make
that version the default version.


Which wouldn't be usable on any system that has to boot/process
unattended, and run's Python scripts for configuration set-up.


I can understand that but my use of Python on Windows is not that case. 
I simply want to be able to choose which version of Python runs when it 
is invoked, when I have multiple versions installed. Surely that is a 
very common case for end-users running 'python' or invoking some script 
which is associated with python.




Making a version default pretty much means being able to rewrite
the PATH environment variable... And I've seen too many messes made by
some software already (including once having two generations of Python
showing up in one PATH!)


The PATH environment is constantly changing whether in Linux or Windows. 
Claiming that this is too dangerous is silly.


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


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-05 Thread Edward Diener

On 10/1/2012 12:02 PM, Alister wrote:

On Sun, 30 Sep 2012 15:14:17 -0400, Edward Diener wrote:


Has there been any official software that allows both the Python 2.x and
3.x releases to coexist on the same OS so that the end-user can easily
switch between them when invoking Python scripts after each has been
installed to their own directories/folders ?

I know of some unoffical solutions, but they require lots of tweaks.
Given the vagaries of the different OSs on which Python can run I am
hoping for some offical solution which will work on any of the most
popular OSs ( Windows, Linux, Mac ).

The situation is so confusing on Windows, where the file associations,
registry entries, and other internal software which allows a given
Python release to work properly when invoking Python is so complicated,
that I have given up on trying to install more than one Python release
and finding a relaible, foolproof way of switching between them. So
although I would like to use the latest 3.x series on Windows I have
decide to stick with the latest 2.x series instead because much software
using Python does not support 3.x yet.


on my fedora system it was a simple matter of:-
# yum install python3

to use python 3 i specify it in my shebang line

#!/usr/bun/env python3

Simple

Not sure about Windoze though (Although from memory the install asks
where to install so should not be a major issue)


Windows installs of Python do not distinguish releases by Pythonx(.x) 
but just install different versions of Python in different directories. 
However one can make links to the different versions based on their 
release numbers, and that would allow a shebang line work if it was 
supported.



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


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-05 Thread Edward Diener

On 9/30/2012 3:38 PM, Andrew Berg wrote:

On 2012.09.30 14:14, Edward Diener wrote:

The situation is so confusing on Windows, where the file associations,
registry entries, and other internal software which allows a given
Python release to work properly when invoking Python is so complicated,
that I have given up on trying to install more than one Python release
and finding a relaible, foolproof way of switching between them. So
although I would like to use the latest 3.x series on Windows I have
decide to stick with the latest 2.x series instead because much software
using Python does not support 3.x yet.


http://www.python.org/dev/peps/pep-0397/

Unix-based OSes should already obey the shebang line, and on Windows,
there's py.exe in 3.3 that will launch the intended version based on
that shebang line. While I was using the alpha/beta versions of 3.3, I
had no problems invoking either 3.2 or 3.3 with the shebang line on Windows.



Thanks ! I will get this and hopefully it will do what I want.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-05 Thread Mark Lawrence

On 05/10/2012 13:15, Edward Diener wrote:

On 10/1/2012 12:02 PM, Alister wrote:

On Sun, 30 Sep 2012 15:14:17 -0400, Edward Diener wrote:


Has there been any official software that allows both the Python 2.x and
3.x releases to coexist on the same OS so that the end-user can easily
switch between them when invoking Python scripts after each has been
installed to their own directories/folders ?

I know of some unoffical solutions, but they require lots of tweaks.
Given the vagaries of the different OSs on which Python can run I am
hoping for some offical solution which will work on any of the most
popular OSs ( Windows, Linux, Mac ).

The situation is so confusing on Windows, where the file associations,
registry entries, and other internal software which allows a given
Python release to work properly when invoking Python is so complicated,
that I have given up on trying to install more than one Python release
and finding a relaible, foolproof way of switching between them. So
although I would like to use the latest 3.x series on Windows I have
decide to stick with the latest 2.x series instead because much software
using Python does not support 3.x yet.


on my fedora system it was a simple matter of:-
# yum install python3

to use python 3 i specify it in my shebang line

#!/usr/bun/env python3

Simple

Not sure about Windoze though (Although from memory the install asks
where to install so should not be a major issue)


Windows installs of Python do not distinguish releases by Pythonx(.x)
but just install different versions of Python in different directories.
However one can make links to the different versions based on their
release numbers, and that would allow a shebang line work if it was
supported.




Please read this http://www.python.org/dev/peps/pep-0397/ and let us 
know whether or not it fits your needs on Windows.


--
Cheers.

Mark Lawrence.

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


Re: When was the last time you did something for the first time?

2012-10-05 Thread Ramchandra Apte
On Friday, 5 October 2012 16:33:52 UTC+5:30, The Matchmaker  wrote:
 What do you want to talk about today?

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


Re: How to create a login screen using core python language without using any framework

2012-10-05 Thread Joel Goldstick
On Fri, Oct 5, 2012 at 5:29 AM, Hans Mulder han...@xs4all.nl wrote:
 On 5/10/12 10:03:56, shivakrsh...@gmail.com wrote:
 I need to develop a simple login page using Python language with
 two fields and a button, like:

 Username, Password, Login

 I know there are some beautiful Python frameworks like

 Django, Grok, WebPy, TurboGears

 which support web development using Python, but mine is a basic
 requirement consisting of only 3 screens (pages):

 * 1st page  -  Login page (Redirects to 2nd page when login button
   is clicked)
 * 2nd page  -  Page with records in the form of a list, with an
   option for adding new records (Redirects to 3rd page when Add
   Records button is clicked)
 * 3rd page  -  Page with fields, which are saved as records for
   the list on 2nd page  (After entering details and clicking Submit)

 Implementing your application using any of those frameworks you
 mentioned, would be easy.

 So, I have decided to develop the above functionality using Python
 **without** using any framework, so that I can have flexibility as
 well as write my own code.

 This is a bad idea.  You'll get much more flexibility using
 an existing framework then you'd ever achieve by reinventing
 the wheel on your own.  Especially if you have no experience
 in this field.

 1. Is it possible to create a login page using Python without
 using a framework?

 Yes.

 But it's a lot of work.  You'd effectively be rewriting all
 the functionality you'd get for free with a framework.  And
 it wouldn't be as flexible, because frameworks can flex in
 directions that you didn't think of.

 2. I haven't worked on web services and don't know the basics of
 web development in Python.

 In that case, your chances of success are fairly slim.

 3. If possible, can you provide me an example on how to create a
 login page using Python and achieve the functionality described
 above?

 The frameworks you mentioned earlier come with tutorials.
 These tutorials contain such examples.

 You should really use an existing framework.  Once you're
 aware of how much functionality you get out of a framework
 (any of them), you wouldn't dream of rewriting all that
 functionality on your own.

I totally agree about using a framework.  You say you want a 'simple'
3 page website.  Why do you think it is simple?  You say you don't
have any skills at creating websites with python.  From your
description, you will need to build a directory of entries, a form,
and attach it to a database, so that means you also need to understand
sql (or something!). You need to display individual records I imagine.
 Do you need to edit them after they are created?  How are you going
to manage the accounts?  Will you create them?  Will you let the
visitor create an account?  Where will you store the account
information?  Do different accounts have different permissions?

If you install django (for instance), go through the online tutorials
in about 2 hours, you could probably build your specification in a
day.  Even if you have problems there is an active django mailing list
to ask specific questions.  I haven't tried the other frameworks, but
there might be similar help available for them.


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


Re: final question: logging to stdout and updating files

2012-10-05 Thread Ramchandra Apte
On Thursday, 4 October 2012 19:30:26 UTC+5:30, Steven D'Aprano  wrote:
 On Thu, 04 Oct 2012 06:34:28 -0700, Ramchandra Apte wrote:
 
 
 
  Optimize code always even if it causes bugs - Ramchandra Apte, 2001-
 
 
 
 Well, you've just added yourself into my list of people whose advice 
 
 should always be ignored.
 
 
 
 That is *terrible* advice. But if you insist on following it, you can 
 
 optimize *any* Python program to this:
 
 
 
 # === start code ===
 
 pass  # this line is optional
 
 # === end code ===
 
 
 
 
 
 There you go. The most heavily optimized, fastest Python program in 
 
 existence. Sure, it has a few bugs, but boy is it fast!!!
 
 
 
 
 
 -- 
 
 Steven

Please disclose the list of people.

This email is subject to important disclosures available at 
loobafoobajo.ke/legal.html
LOOBA FOOBA JOKE COMPANY MAKES NO WARRANTIES ABOUT THIS EMAIL
Read at your risk - you may die from reading this email. ;-P
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sum function

2012-10-05 Thread Mike
On Thursday, October 4, 2012 4:52:50 PM UTC-4, Mike wrote:
 Hi All,
 
 
 
 I am new to python and am getting the data from hbase. 
 
 I am trying to do sum on the column as below
 
 
 
 
 
 scanner = client.scannerOpenWithStop(tab, 10, 1000, [cf:col1])
 
 total = 0.0
 
 r = client.scannerGet(scanner)
 
 while r:
 
   for k in (r[0].columns):
 
 total += float(r[0].columns[k].value)
 
   r = client.scannerGet(scanner)
 
 
 
 print total
 
 
 
 Do you know of better (faster) way to do sum?
 
 
 
 Any thoughts please?
 
 
 
 Thanks

Sorry about that. Here you go

Traceback (most recent call last):
  File test.py, line 17, in module
total = sum(float(col.value) for r in iter(next_r, None) for col in 
r[0].columns.itervalues())
  File test.py, line 17, in genexpr
total = sum(float(col.value) for r in iter(next_r, None) for col in 
r[0].columns.itervalues())
IndexError: list index out of range
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sum function

2012-10-05 Thread Ramchandra Apte
On Friday, 5 October 2012 19:09:15 UTC+5:30, Mike  wrote:
 On Thursday, October 4, 2012 4:52:50 PM UTC-4, Mike wrote:
 
  Hi All,
 
  
 
  
 
  
 
  I am new to python and am getting the data from hbase. 
 
  
 
  I am trying to do sum on the column as below
 
  
 
  
 
  
 
  
 
  
 
  scanner = client.scannerOpenWithStop(tab, 10, 1000, [cf:col1])
 
  
 
  total = 0.0
 
  
 
  r = client.scannerGet(scanner)
 
  
 
  while r:
 
  
 
for k in (r[0].columns):
 
  
 
  total += float(r[0].columns[k].value)
 
  
 
r = client.scannerGet(scanner)
 
  
 
  
 
  
 
  print total
 
  
 
  
 
  
 
  Do you know of better (faster) way to do sum?
 
  
 
  
 
  
 
  Any thoughts please?
 
  
 
  
 
  
 
  Thanks
 
 
 
 Sorry about that. Here you go
 
 
 
 Traceback (most recent call last):
 
   File test.py, line 17, in module
 
 total = sum(float(col.value) for r in iter(next_r, None) for col in 
 r[0].columns.itervalues())
 
   File test.py, line 17, in genexpr
 
 total = sum(float(col.value) for r in iter(next_r, None) for col in 
 r[0].columns.itervalues())
 
 IndexError: list index out of range

the variable r is an empty list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sum function

2012-10-05 Thread Mike
On Friday, October 5, 2012 9:41:44 AM UTC-4, Ramchandra Apte wrote:
 On Friday, 5 October 2012 19:09:15 UTC+5:30, Mike  wrote:
 
  On Thursday, October 4, 2012 4:52:50 PM UTC-4, Mike wrote:
 
  
 
   Hi All,
 
  
 
   
 
  
 
   
 
  
 
   
 
  
 
   I am new to python and am getting the data from hbase. 
 
  
 
   
 
  
 
   I am trying to do sum on the column as below
 
  
 
   
 
  
 
   
 
  
 
   
 
  
 
   
 
  
 
   
 
  
 
   scanner = client.scannerOpenWithStop(tab, 10, 1000, [cf:col1])
 
  
 
   
 
  
 
   total = 0.0
 
  
 
   
 
  
 
   r = client.scannerGet(scanner)
 
  
 
   
 
  
 
   while r:
 
  
 
   
 
  
 
 for k in (r[0].columns):
 
  
 
   
 
  
 
   total += float(r[0].columns[k].value)
 
  
 
   
 
  
 
 r = client.scannerGet(scanner)
 
  
 
   
 
  
 
   
 
  
 
   
 
  
 
   print total
 
  
 
   
 
  
 
   
 
  
 
   
 
  
 
   Do you know of better (faster) way to do sum?
 
  
 
   
 
  
 
   
 
  
 
   
 
  
 
   Any thoughts please?
 
  
 
   
 
  
 
   
 
  
 
   
 
  
 
   Thanks
 
  
 
  
 
  
 
  Sorry about that. Here you go
 
  
 
  
 
  
 
  Traceback (most recent call last):
 
  
 
File test.py, line 17, in module
 
  
 
  total = sum(float(col.value) for r in iter(next_r, None) for col in 
  r[0].columns.itervalues())
 
  
 
File test.py, line 17, in genexpr
 
  
 
  total = sum(float(col.value) for r in iter(next_r, None) for col in 
  r[0].columns.itervalues())
 
  
 
  IndexError: list index out of range
 
 
 
 the variable r is an empty list

Here is the actual code.

scanner = client.scannerOpenWithStop(tab, 10, 1000, [cf:col1]) 
next_r = functools.partial(client.scannerGet, scanner)
total = sum(float(col.value) for r in iter(next_r, None) for col in 
r[0].columns.itervalues())


Scanner does have rows.

Are we missing something please?

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


Re: How to call python script from web.

2012-10-05 Thread Joel Goldstick
On Fri, Oct 5, 2012 at 9:59 AM, Mike mike20...@gmail.com wrote:
 Hi,

 I can call the php script from browser assuming apache web server exists.

 How can I call the python script like php script?

 Any thought?

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

A popular way for apache is to use mod_wsgi. http://code.google.com/p/modwsgi/



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


Re: How to create a login screen using core python language without using any framework

2012-10-05 Thread Demian Brecht

On 12-10-05 06:11 AM, Joel Goldstick wrote:


I totally agree about using a framework.  You say you want a 'simple'
3 page website.  Why do you think it is simple?  You say you don't
have any skills at creating websites with python.  From your
description, you will need to build a directory of entries, a form,
and attach it to a database, so that means you also need to understand
sql (or something!). You need to display individual records I imagine.
  Do you need to edit them after they are created?  How are you going
to manage the accounts?  Will you create them?  Will you let the
visitor create an account?  Where will you store the account
information?  Do different accounts have different permissions?

Not to mention security. Frameworks like Django provide protection 
against things like:


* CSRF (Cross Site Request Forgery)
* XSS ((X)Cross Site Scripting)
* SQL injection

As well as others. For a comprehensive list of protection that Django 
offers, check out https://docs.djangoproject.com/en/dev/topics/security/.


--
Demian Brecht
@demianbrecht
http://demianbrecht.github.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: notmm is dead!

2012-10-05 Thread Michael Torrie
On 10/05/2012 04:43 AM, Etienne Robillard wrote:
 No. All past notmm licenses were and still ARE ISC licensed. The license fee
 is simply because I'm shifting into commercial license for new releases, 
 including
 the newer 0.4.5 version... Pypi was not the authority source for notmm and 
 neither anyone can claim the license was left blank, thats once again a form 
 of plagiarism. 
 
 Shall anyone is really serious about supporting the work i did then he'll 
 want to pay a minimal fee to get
 the proper license rights and can contact me off-list if he want to fork a 
 branch
 to github of google code.

Someone certainly could fork any past ISC version and proceed from
there.  That is simply my point.  Without any license fees and without
any accusation of plagiarism.  Indeed it wouldn't be plagiarism
because your name would still be on it, and copyright assigned to you.

I don't know what you are talking about with the plagiarism thing.  If
there indeed was a tarball out there with an empty license file all that
would do would be to prevent the downloader from legally doing
*anything* with the file.  That's all the original poster was saying.

We're just trying to be clear on the terms here, not accusing you of
anything, nor trying to denigrate all your hard work.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: + in regular expression

2012-10-05 Thread Evan Driscoll

On 10/05/2012 04:23 AM, Duncan Booth wrote:

A regular expression element may be followed by a quantifier.
Quantifiers are '*', '+', '?', '{n}', '{n,m}' (and lazy quantifiers
'*?', '+?', '{n,m}?'). There's nothing in the regex language which says
you can follow an element with two quantifiers.

In fact, *you* did -- the first sentence of that paragraph! :-)

\s is a regex, so you can follow it with a quantifier and get \s{6}. 
That's also a regex, so you should be able to follow it with a quantifier.


I can understand that you can create a grammar that excludes it. I'm 
actually really interested to know if anyone knows whether this was a 
deliberate decision and, if so, what the reason is. (And if not -- 
should it be considered a (low priority) bug?)


Was it because such patterns often reveal a mistake? Because \s{6}+ 
has other meanings in different regex syntaxes and the designers didn't 
want confusion? Because it was simpler to parse that way? Because the 
hey you recognize regular expressions by converting it to a finite 
automaton story is a lie in most real-world regex implementations (in 
part because they're not actually regular expressions) and repeated 
quantifiers cause problems with the parsing techniques that actually get 
used?


Evan

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


Re: notmm is dead!

2012-10-05 Thread Ian Kelly
On Oct 4, 2012 6:56 PM, Etienne Robillard animelo...@gmail.com wrote:

 You probably have a old tarball or something...

Not unless you've replaced it since I made my post, as I had just
downloaded it to check the license.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: + in regular expression

2012-10-05 Thread Evan Driscoll

On 10/05/2012 10:27 AM, Evan Driscoll wrote:

On 10/05/2012 04:23 AM, Duncan Booth wrote:

A regular expression element may be followed by a quantifier.
Quantifiers are '*', '+', '?', '{n}', '{n,m}' (and lazy quantifiers
'*?', '+?', '{n,m}?'). There's nothing in the regex language which says
you can follow an element with two quantifiers.

In fact, *you* did -- the first sentence of that paragraph! :-)

\s is a regex, so you can follow it with a quantifier and get \s{6}. 
That's also a regex, so you should be able to follow it with a 
quantifier.
OK, I guess this isn't true... you said a regular expression *element* 
can be followed by a quantifier. I just took what I usually see as part 
of a regular expression and read into your post something it didn't 
quite say. Still, the rest of mine applies.


Evan

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


RE: When was the last time you did something for the first time?

2012-10-05 Thread Hector Chapa
I learn trigonometry

-Original Message-
From: Ramchandra Apte [mailto:maniandra...@gmail.com] 
Sent: Friday, October 05, 2012 8:03 AM
To: python-list@python.org
Subject: Re: When was the last time you did something for the first time?

On Friday, 5 October 2012 16:33:52 UTC+5:30, The Matchmaker  wrote:
 What do you want to talk about today?

Nothing.


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


Re: notmm is dead!

2012-10-05 Thread Etienne Robillard
On Fri, 5 Oct 2012 09:29:39 -0600
Ian Kelly ian.g.ke...@gmail.com wrote:

 On Oct 4, 2012 6:56 PM, Etienne Robillard animelo...@gmail.com wrote:
 
  You probably have a old tarball or something...
 
 Not unless you've replaced it since I made my post, as I had just
 downloaded it to check the license.

The 0.4.4 release is old, however, so you might really got a wrong tarball. :-)

Cheers,
Etienne



-- 
Etienne Robillard
Green Tea Hackers Club
Fine Software Carpentry For The Rest Of Us!
http://gthc.org/
e...@gthcfoundation.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: + in regular expression

2012-10-05 Thread MRAB

On 2012-10-05 16:27, Evan Driscoll wrote:

On 10/05/2012 04:23 AM, Duncan Booth wrote:

A regular expression element may be followed by a quantifier.
Quantifiers are '*', '+', '?', '{n}', '{n,m}' (and lazy quantifiers
'*?', '+?', '{n,m}?'). There's nothing in the regex language which says
you can follow an element with two quantifiers.

In fact, *you* did -- the first sentence of that paragraph! :-)

\s is a regex, so you can follow it with a quantifier and get \s{6}.
That's also a regex, so you should be able to follow it with a quantifier.

I can understand that you can create a grammar that excludes it. I'm
actually really interested to know if anyone knows whether this was a
deliberate decision and, if so, what the reason is. (And if not --
should it be considered a (low priority) bug?)

Was it because such patterns often reveal a mistake? Because \s{6}+
has other meanings in different regex syntaxes and the designers didn't
want confusion? Because it was simpler to parse that way? Because the
hey you recognize regular expressions by converting it to a finite
automaton story is a lie in most real-world regex implementations (in
part because they're not actually regular expressions) and repeated
quantifiers cause problems with the parsing techniques that actually get
used?

You rarely want to repeat a repeated element. It can also result in 
catastrophic

backtracking unless you're _very_ careful.

In many other regex implementations (including mine), *+, *+ and
?+ are possessive quantifiers, much as ??, *? and ?? are lazy
quantifiers.

You could, of course, ask why adding ? after a quantifier doesn't
make it optional, e.g. why r\s{6}? doesn't mean the same as
r(?:\s{6})?, or why r\s{0,6}? doesn't mean the same as
r(?:\s{0,6})?.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [fcgi.py] Force cache upgrade?

2012-10-05 Thread Michael Ströder
Gilles wrote:
 On Fri, 28 Sep 2012 23:57:14 +0200, Gilles nos...@nospam.com wrote:
 I guess the FastCGI server (Flup) only updates its cache every so
 often. Do I need to type a command to force Flup to recompile the
 Python script?
 
 Turns out that, yes, mod_fcgid is configured to reload a script only
 after some time or some number of hits,

Well, that's the whole point of using FastCGI:
Have a long-running process for better performance.

Ciao, Michael.

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


instance.attribute lookup

2012-10-05 Thread Ethan Furman
There is a StackOverflow question [1] that points to this on-line book 
[2] which has a five-step sequence for looking up attributes:


 When retrieving an attribute from an object (print
 objectname.attrname) Python follows these steps:

 1. If attrname is a special (i.e. Python-provided) attribute for
 objectname, return it.

 2. Check objectname.__class__.__dict__ for attrname. If it exists and
 is a data-descriptor, return the descriptor result. Search all bases
 of objectname.__class__ for the same case.

 3. Check objectname.__dict__ for attrname, and return if found. If
 objectname is a class, search its bases too. If it is a class and a
 descriptor exists in it or its bases, return the descriptor result.

 4. Check objectname.__class__.__dict__ for attrname. If it exists and
 is a non-data descriptor, return the descriptor result. If it exists,
 and is not a descriptor, just return it. If it exists and is a data
 descriptor, we shouldn't be here because we would have returned at
 point 2. Search all bases of objectname.__class__ for same case.

 5. Raise AttributeError

I'm thinking step 1 is flat-out wrong and doesn't exist.  Does anybody 
know otherwise?


~Ethan~

[1]
http://stackoverflow.com/q/10536539/208880

[2]
http://www.cafepy.com/article/python_attributes_and_methods/ch01s05.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: sum function

2012-10-05 Thread Terry Reedy

On 10/5/2012 9:47 AM, Mike wrote:

On Friday, October 5, 2012 9:41:44 AM UTC-4, Ramchandra Apte wrote:

On Friday, 5 October 2012 19:09:15 UTC+5:30, Mike  wrote:


On Thursday, October 4, 2012 4:52:50 PM UTC-4, Mike wrote:







Hi All,































I am new to python and am getting the data from hbase.


If you want as many people as possible to read your posts, stop using a 
mail-agent and site that spits in the face of readers by doubling blank 
lines each iteration. Alternatives have been discussed previously.


--
Terry Jan Reedy

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


calendar from python to html

2012-10-05 Thread Luca Sanna
hi,

I enter a calendar in an html page
in each calendar day, I enter a time that is used by the program to perform 
actions with python

What can I use to do this?

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


Re: sum function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 7:39 AM, Mike mike20...@gmail.com wrote:
 Sorry about that. Here you go

 Traceback (most recent call last):
   File test.py, line 17, in module
 total = sum(float(col.value) for r in iter(next_r, None) for col in 
 r[0].columns.itervalues())
   File test.py, line 17, in genexpr
 total = sum(float(col.value) for r in iter(next_r, None) for col in 
 r[0].columns.itervalues())
 IndexError: list index out of range

Maybe the sentinel value is not None as I assumed, and it's
overrunning the end of the data?  What does
client.scannerGet return when there is no more data?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Are ABCs an anti-pattern?

2012-10-05 Thread Trent Nelson
On Tue, Oct 02, 2012 at 07:23:05AM -0700, Demian Brecht wrote:
 I don't use them anymore, but I'm curious about others opinions on this 
 list...

I like them.  In particular, I like that I can enumerate all the
subclasses that happen to implement the ABC via the metaclass's
__subclasses__() method.  I also like that I can trust Python
not to instantiate a subclass of an ABC unless it meets all the
interface criteria I've stipulated.

Both of these aspects make ABCs a great fit when your base classes
will be subclassed by other users/libraries (i.e. that you have no
control over).

For example, I use them in a project of mine called Enversion in
order to automatically generate command-line scaffolding with as
little effort (programming/typing-wise as possible).  The ABC
stuff lives in 'evn.cli' and provides a set of generic classes
for command-line tools.

One of the command line tools that ships with Enversion is the
'evnadmin' command.  Thanks to all the ABC scaffolding in the
'evn.cli/command' module, all I need to write is the following
to get an 'evnadmin' command-line interface:

from evn.cli import (
CLI,
CommandLine,
)

class AdminCommandLine(CommandLine):
@property
def commands_module(self):
return evn.admin.commands

class AdminCLI(CLI):

@property
def program_name(self):
return 'evnadmin'

@property
def commandline_subclasses(self):
return AdminCommandLine.__subclasses__()

class DoctestCommandLine(AdminCommandLine):
_quiet_ = True

class DumpDefaultConfigCommandLine(AdminCommandLine):
pass

class DumpConfigCommandLine(AdminCommandLine):
_conf_ = True

class ShowConfigFileLoadOrderCommandLine(AdminCommandLine):
_conf_ = True

class DumpHookCodeCommandLine(AdminCommandLine):
_conf_ = True
_repo_ = True

[snip]

Running 'evnadmin' with no arguments yields this:

% evnadmin
Type 'evnadmin subcommand help' for help on a specific subcommand.

Available subcommands:
analyze
create
disable-remote-debug (drd)
doctest
dump-config (dc)
dump-default-config (ddc)
dump-hook-code (dhc)
enable
enable-remote-debug (erd)
find-merges (fm)
fix-hooks (fh)
root-info (ri)
run-hook (rh)
show-config-file-load-order (scflo)
show-repo-hook-status (srhs)
show-repo-remote-debug-sessions (srrds)
show-roots (sr)
toggle-remote-debug (trd)
version

The scaffolding can generate all of that automatically thanks to the
ability to enumerate __subclasses__() of a metaclass.  The fact that
Python will bomb out if a derived class doesn't implement all the
required methods/properties is icing on the cake.  When you are
expecting other developers to leverage your ABCs, getting instant
feedback when you forget to implement a required method/property
is incredibly useful.  It's definitely not a case of battling the
design decisions made by the ABC author...

Relevant Python files:
https://github.com/tpn/enversion/blob/master/evn/cli.py
https://github.com/tpn/enversion/blob/master/evn/admin/cli.py

Regards,

Trent.

 Demian Brecht
 @demianbrecht
 http://demianbrecht.github.com
 -- 
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sum function

2012-10-05 Thread Mike
I added the print command.

It prints [] when there is no data.

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


RE: notmm is dead!

2012-10-05 Thread Prasad, Ramit
Steven D'Aprano wrote:
 Sent: Thursday, October 04, 2012 7:22 PM
 To: python-list@python.org
 Subject: Re: notmm is dead!
 
 On Thu, 04 Oct 2012 14:10:46 -0400, Etienne Robillard wrote:
 
  Dear list,
 
  Due to lack of energy and resources i'm really sad to announce the
  removal of notmm from pypi and bitbucket.
 
 Well that's just rude. Even if you don't intend to maintain the software
 any more, why are you removing it from pypi? Since you say you are a fan
 of Open Source software, just flag it as unmaintained and leave it for
 somebody else to pick up.
 
 If you are going to abandon the project, release it on PyPI with a dual
 MIT and GPL licence, and let it be taken over by somebody else.
 
 If you were looking for sympathy here, starting off by removing your
 project from free hosting, then complaining that you can't pay for the
 non-free hosting, was NOT the right way to do so.

I might be misunderstanding, but I think Etienne wants money in 
exchange for letting someone else take over. 

 
 By the way, the latest version of notmm (0.4.4) has an empty licence
 file. No licence means that everyone using it is unlicenced and therefore
 infringing your copyright.
 
 


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sum function

2012-10-05 Thread Mike
Terry,

I am not using the mail client. I am just posting on the site.

Something wrong with this site. When you do individual reply, it does the 
double posting which it shouldn't. See Ramachandra Apte's reply. It is posted 
twice too.

Thanks



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


Re: sum function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 2:03 PM, Mike mike20...@gmail.com wrote:
 I added the print command.

 It prints [] when there is no data.

Change iter(next_r, None) to iter(next_r, [])
-- 
http://mail.python.org/mailman/listinfo/python-list


fmap(), inverse of Python map() function

2012-10-05 Thread vasudevram

http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html

- Vasudev Ram
www.dancingbison.com
jugad2.blogspot.com
twitter.com/vasudevram
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sum function

2012-10-05 Thread Dave Angel
On 10/05/2012 04:09 PM, Mike wrote:
 Terry,

 I am not using the mail client. I am just posting on the site.

And which site would that be (that you're using)?  There are a few.  I'm
guessing you use google-groups.  And all of them get gatewayed to the
actual list, with differing numbers of bugs. 

I use email to access it directly.  I solve one of the duplicate-message
problems with google groups by automatically deleting any message
addressed to google-groups.  There are about 100 such messages each month.

Another problem is that lots of these gateways post to both the
newsgroup and to the python-list.


 Something wrong with this site. When you do individual reply, it does the 
 double posting which it shouldn't. See Ramachandra Apte's reply. It is 
 posted twice too.

 Thanks





-- 

DaveA

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


Re: sum function

2012-10-05 Thread Mike
That worked, Ian.

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


Re: fmap(), inverse of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 2:19 PM, vasudevram vasudev...@gmail.com wrote:

 http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html

Your fmap is a special case of reduce.

def fmap(functions, argument):
return reduce(lambda result, func: func(result), functions, argument)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fmap(), inverse of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 3:31 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
 On Fri, Oct 5, 2012 at 2:19 PM, vasudevram vasudev...@gmail.com wrote:

 http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html

 Your fmap is a special case of reduce.

 def fmap(functions, argument):
 return reduce(lambda result, func: func(result), functions, argument)

In a more functional style, you could also use reduce to compose the
functions before applying them:

def compose(f, g):
return lambda x: f(g(x))

def fmap(functions):
return reduce(compose, reversed(functions))

# Allowing you to then do:
result = fmap(functions)(argument)

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


Job

2012-10-05 Thread dave
Looking for entry to mid level Python Developer for Contract job in New 
England. Let me know if you want to hear more.
-- 
http://mail.python.org/mailman/listinfo/python-list


Executing untrusted scripts in a sandboxed environment

2012-10-05 Thread Robin Krahl
Hi all,

I need to execute untrusted scripts in my Python application. To avoid security 
issues, I want to use a sandboxed environment. This means that the script 
authors have no access to the file system. They may only access objects, 
modules and classes that are flagged or approved for scripting.

I read that I will not be able to do this with Python scripts. (See 
SandboxedPython page in the Python wiki [0] and several SE.com questions, e. g. 
[1].) So my question is: What is the best way to embed a script engine in a 
sandboxed environment that has access to the Python modules and classes that I 
provide?

Thanks for your help.

Best regards,
Robin

[0] http://wiki.python.org/moin/SandboxedPython
[1] 
http://stackoverflow.com/questions/3068139/how-can-i-sandbox-python-in-pure-python
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fmap(), inverse of Python map() function

2012-10-05 Thread Devin Jeanpierre
On Fri, Oct 5, 2012 at 5:31 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
 On Fri, Oct 5, 2012 at 2:19 PM, vasudevram vasudev...@gmail.com wrote:

 http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html

 Your fmap is a special case of reduce.

So is map.

def map(f, seq):
return reduce(
lambda rseq, newpre:
rseq.append(f(newpre)) or rseq,
seq,
[])

X is a special case of reduce is basically the same as saying X can
be implemented using a for loop. If it's meant as a complaint, it's a
poor one.

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


Re: instance.attribute lookup

2012-10-05 Thread Steven D'Aprano
On Fri, 05 Oct 2012 10:39:53 -0700, Ethan Furman wrote:

 There is a StackOverflow question [1] that points to this on-line book
 [2] which has a five-step sequence for looking up attributes:
 
   When retrieving an attribute from an object (print
   objectname.attrname) Python follows these steps:
  
   1. If attrname is a special (i.e. Python-provided) attribute for
   objectname, return it.
[...]
 I'm thinking step 1 is flat-out wrong and doesn't exist.  Does anybody
 know otherwise?

I'm thinking I don't even understand what step 1 means.

What's a Python-provided attribute, and how is it different from other 
attributes?



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


Re: instance.attribute lookup

2012-10-05 Thread Ethan Furman

Steven D'Aprano wrote:

On Fri, 05 Oct 2012 10:39:53 -0700, Ethan Furman wrote:


There is a StackOverflow question [1] that points to this on-line book
[2] which has a five-step sequence for looking up attributes:

  When retrieving an attribute from an object (print
  objectname.attrname) Python follows these steps:
 
  1. If attrname is a special (i.e. Python-provided) attribute for
  objectname, return it.

[...]

I'm thinking step 1 is flat-out wrong and doesn't exist.  Does anybody
know otherwise?


I'm thinking I don't even understand what step 1 means.

What's a Python-provided attribute, and how is it different from other 
attributes?


Well, if /you/ don't understand it I feel a lot better about not 
understanding it either!  :)


Glad to know I'm not missing something (besides ESP, a crystal ball, and 
a mind-reader!)


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


Re: fmap(), inverse of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 4:52 PM, Devin Jeanpierre jeanpierr...@gmail.com wrote:
 On Fri, Oct 5, 2012 at 5:31 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
 On Fri, Oct 5, 2012 at 2:19 PM, vasudevram vasudev...@gmail.com wrote:

 http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html

 Your fmap is a special case of reduce.

 So is map.

I realize that.  My point is that the function *feels* more like a
variant of reduce than of map.

 If it's meant as a complaint, it's a poor one.

It's not.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: instance.attribute lookup

2012-10-05 Thread Christian Heimes
Am 05.10.2012 19:39, schrieb Ethan Furman:
 I'm thinking step 1 is flat-out wrong and doesn't exist.  Does anybody
 know otherwise?

The answer is confusing and also wrong. For instance it ignores the
existence of __slots__, metaclasses and the different lookup strategy of
__special__ methods in old style and new style classes.

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


Re: instance.attribute lookup

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 11:39 AM, Ethan Furman et...@stoneleaf.us wrote:
 There is a StackOverflow question [1] that points to this on-line book [2]
 which has a five-step sequence for looking up attributes:

 When retrieving an attribute from an object (print
 objectname.attrname) Python follows these steps:

 1. If attrname is a special (i.e. Python-provided) attribute for
 objectname, return it.

 2. Check objectname.__class__.__dict__ for attrname. If it exists and
 is a data-descriptor, return the descriptor result. Search all bases
 of objectname.__class__ for the same case.

 3. Check objectname.__dict__ for attrname, and return if found. If
 objectname is a class, search its bases too. If it is a class and a
 descriptor exists in it or its bases, return the descriptor result.

 4. Check objectname.__class__.__dict__ for attrname. If it exists and
 is a non-data descriptor, return the descriptor result. If it exists,
 and is not a descriptor, just return it. If it exists and is a data
 descriptor, we shouldn't be here because we would have returned at
 point 2. Search all bases of objectname.__class__ for same case.

 5. Raise AttributeError

 I'm thinking step 1 is flat-out wrong and doesn't exist.  Does anybody know
 otherwise?

I think step 1 refers to looking up attributes like foo.__class__ or
foo.__dict__ themselves.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: instance.attribute lookup

2012-10-05 Thread Mark Lawrence

On 06/10/2012 00:12, Ethan Furman wrote:

Steven D'Aprano wrote:

On Fri, 05 Oct 2012 10:39:53 -0700, Ethan Furman wrote:


There is a StackOverflow question [1] that points to this on-line book
[2] which has a five-step sequence for looking up attributes:

  When retrieving an attribute from an object (print
  objectname.attrname) Python follows these steps:
 
  1. If attrname is a special (i.e. Python-provided) attribute for
  objectname, return it.

[...]

I'm thinking step 1 is flat-out wrong and doesn't exist.  Does anybody
know otherwise?


I'm thinking I don't even understand what step 1 means.

What's a Python-provided attribute, and how is it different from other
attributes?


Well, if /you/ don't understand it I feel a lot better about not
understanding it either!  :)

Glad to know I'm not missing something (besides ESP, a crystal ball, and
a mind-reader!)

~Ethan~


My probably highly uneducated guess is that Python-provided attribute 
refers to double underscore names. YMMV by several trillion light years :)


--
Cheers.

Mark Lawrence.

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


Re: fmap(), inverse of Python map() function

2012-10-05 Thread Devin Jeanpierre
On Fri, Oct 5, 2012 at 7:24 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
 I realize that.  My point is that the function *feels* more like a
 variant of reduce than of map.

 If it's meant as a complaint, it's a poor one.

 It's not.

Fair enough all around. Sorry for misunderstanding.

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


Re: + in regular expression

2012-10-05 Thread Cameron Simpson
On 05Oct2012 10:27, Evan Driscoll drisc...@cs.wisc.edu wrote:
| I can understand that you can create a grammar that excludes it. [...]
| Was it because such patterns often reveal a mistake?

For myself, I would consider that sufficient reason.

I've seen plenty of languages (C and shell, for example, though they
are not alone or egrarious) where a compiler can emit a syntax complaint
many lines from the actual coding mistake (in shell, an unclosed quote
or control construct is a common examplei; Python has the same issue
but mitigated by the indentation requirements which cut the occurence
down a lot).

Forbidding a common error by requiring a wordier workaround isn't
unreasonable.

| Because \s{6}+ 
| has other meanings in different regex syntaxes and the designers didn't 
| want confusion?

I think Python REs are supposed to be Perl compatible; ISTR an opening
sentence to that effect...

| Because it was simpler to parse that way? Because the 
| hey you recognize regular expressions by converting it to a finite 
| automaton story is a lie in most real-world regex implementations (in 
| part because they're not actually regular expressions) and repeated 
| quantifiers cause problems with the parsing techniques that actually get 
| used?

There are certainly constructs that can cause an exponential amount
of backtracking is misused. One could make a case for discouragement
(though not a case for forbidding them).

Just my 2c,
-- 
Cameron Simpson c...@zip.com.au

The most annoying thing about being without my files after our disc crash was
discovering once again how widespread BLINK was on the web.
-- 
http://mail.python.org/mailman/listinfo/python-list


Problems building Python from hg trunk on Open SUSE

2012-10-05 Thread Skip Montanaro
I haven't messed around with Python 3 recently, so decided to give it
a whirl again.  I cloned the trunk (cpython) and set about it.  This
is on an OpenSUSE 12.1 system.  I configured like so:

  ./configure --prefix=/home/skipm/.linux-local

and ran the usual make ; make install.

I'm a bit perplexed about how it is installed.  Instead of installing
shared objects in

  /home/skipm/.linux-local/lib/python3.4/lib-dynload

they were installed in

/home/skipm/.linux-local/lib64/python3.4/lib-dynload

(note the lib64 vs. lib).  This would be fine, except sys.path
doesn't include the lib64 version of this path:

% PYTHONPATH= PYTHONSTARTUP= ~/.linux-local/bin/python3.4 -S
Could not find platform dependent libraries exec_prefix
Consider setting $PYTHONHOME to prefix[:exec_prefix]
Python 3.4.0a0 (default:26200f535296, Oct  3 2012, 12:48:07)
[GCC 4.4.6 [TWW]] on linux
 import sys
 sys.path
['', '', '/home/skipm/.linux-local/lib/python34.zip',
'/home/skipm/.linux-local/lib/python3.4/',
'/home/skipm/.linux-local/lib/python3.4/plat-linux',
'/home/skipm/.linux-local/lib/lib-dynload']

I see the message about setting PYTHONHOME.  (That happens to be bad
advice as sys.prefix and sys.exec_prefix are identical in this case.)
What I don't understand is why directories containing lib64 are not
in sys.path by default, given that that's where make install put
things.

GCC is as delivered by The Written Word.  (This is a work computer.
The powers that be settled on TWW awhile ago for packaging all open
source software we use on Linux and Solaris, thus removing a headache
from our support staff.)  It is:

% gcc --version
gcc (GCC) 4.4.6 [TWW]
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The architecture looks like this:

% uname -a
Linux udesktop264 3.1.0-1.2-desktop #1 SMP PREEMPT Thu Nov 3 14:45:45
UTC 2011 (187dde0) x86_64 x86_64 x86_64 GNU/Linux

I don't see anything in the output of ./configure --help which
relates to 64-bit install directories, though I do see some lines in
config.log about guessing the architecture.  Some cursory googling
didn't turn up any promising web pages, and I didn't find anything in
the various documentation files in the repo related to building
Python.

Any suggestions about how to resolve this would be appreciated.

Thx,

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


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-05 Thread Edward Diener

On 10/5/2012 5:32 PM, Dennis Lee Bieber wrote:

On Fri, 05 Oct 2012 08:15:30 -0400, Edward Diener
eldiener@tropicsoft.invalid declaimed the following in
gmane.comp.python.general:



Windows installs of Python do not distinguish releases by Pythonx(.x)
but just install different versions of Python in different directories.


Really?

E:\Python27dir
  Volume in drive E is Data
  Volume Serial Number is 2626-D991

  Directory of E:\Python27

08/28/2012  05:32 PMDIR  .
08/28/2012  05:32 PMDIR  ..
08/28/2012  02:11 PMDIR  DLLs
08/28/2012  05:43 PMDIR  Doc
08/28/2012  02:11 PMDIR  include
08/31/2012  04:58 PMDIR  Lib
08/28/2012  02:11 PMDIR  libs
08/28/2012  02:15 PM   108,255 matplotlib-wininst.log
08/28/2012  02:18 PM 4,169 MySQL-python-wininst.log
08/28/2012  02:15 PM98,498 numpy-wininst.log
08/28/2012  02:20 PM17,816 PIL-wininst.log
08/28/2012  03:29 PM 1,572 PyOpenGL-accelerate-wininst.log
08/28/2012  03:38 PM 3,009 pyserial-wininst.log

06/24/2011  12:38 PM27,136 python.exe   
06/24/2011  12:38 PM27,136 python2.7.exe
06/24/2011  12:38 PM27,136 python2.exe  

08/28/2012  05:32 PM90,943 PythonCard-wininst.log

06/24/2011  12:38 PM27,136 pythonw.exe  
06/24/2011  12:38 PM27,136 pythonw2.7.exe   
06/24/2011  12:38 PM27,136 pythonw2.exe 


That's, as you say, ActievState. The normal Python installer does not 
create a python2.7.exe etc.


But of course I can create any links I want, so that's not really the 
problem. The major difficulty is that prior to invoking either python 
directly or a script with a normal Python file association, I want to be 
able to specify which version of Python should be invoked as the default 
without having to specifically invoke a partiocular version  by typing 
'python2.7 ...' or 'python3.3 ...' etc.




08/28/2012  02:15 PM   196,096 Removematplotlib.exe
08/28/2012  02:18 PM   196,096 RemoveMySQL-python.exe
08/28/2012  02:15 PM   196,096 Removenumpy.exe
08/28/2012  02:20 PM   196,096 RemovePIL.exe
08/28/2012  03:29 PM   196,096 RemovePyOpenGL-accelerate.exe
08/28/2012  03:38 PM   196,096 Removepyserial.exe
08/28/2012  05:32 PM61,440 RemovePythonCard.exe
08/28/2012  02:20 PM   196,096 Removereportlab.exe
08/28/2012  02:19 PM   196,096 Removescipy.exe
08/28/2012  05:29 PM   196,096 RemoveWConio.exe
08/28/2012  02:20 PM40,362 reportlab-wininst.log
08/28/2012  02:19 PM   159,420 scipy-wininst.log
08/28/2012  05:32 PMDIR  Scripts
08/28/2012  02:11 PMDIR  tcl
08/28/2012  02:11 PMDIR  Tools
11/28/2007  04:32 PM   258,352 unicows.dll
06/24/2011  12:38 PM49,664 w9xpopen.exe
08/28/2012  05:29 PM   891 WConio-wininst.log
   28 File(s)  2,822,071 bytes
   10 Dir(s)  148,557,684,736 bytes free

E:\Python27

That's what was set up by a recent ActiveState installer (well,
recent for me -- I'd still been using 2.5 three months ago)

Yes, it IS in a version numbered directory, but there are copies of
the executable named as plain python, pythonX, and pythonX.Y

E:\Python27cd %homepath%

E:\UserData\Wulfraed\My Documentspython
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.

^Z



E:\UserData\Wulfraed\My Documentspython2.7
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.




Granted, one would need to have each installation directory in the
PATH, ordered such that the preferred version would be found first when
using just python.


There is much more than just the PATH needed to change to have a 
different Python be the default. File associations also. I thnk there 
are more things too, but I know it has always been difficult on Windows 
to easily change which distribution is called when python is executed 
or some Python file association is executed.


I welcome the new Python launcher for Windows mentioned but have not had 
a chance to use it and see how it works yet. I will try it this weekend 
and hopefully it will work well to solve the problem of having multiple 
Python installations installed on Windows at the same time, and being 
able to easily specify the one I want invoked.


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


Re: Problems building Python from hg trunk on Open SUSE

2012-10-05 Thread Ned Deily
In article 
canc-5uwg-dgcrtkax-xwri4j4sb2gjvtgn2qszj0qxe--v7...@mail.gmail.com,
 Skip Montanaro s...@pobox.com wrote:

 I haven't messed around with Python 3 recently, so decided to give it
 a whirl again.  I cloned the trunk (cpython) and set about it.  This
 is on an OpenSUSE 12.1 system.  I configured like so:
[...] 
 Any suggestions about how to resolve this would be appreciated.

It looks like you're running into the problems described in:

http://bugs.python.org/issue15631

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

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


Re: notmm is dead!

2012-10-05 Thread 88888 Dihedral
Prasad, Ramit於 2012年10月6日星期六UTC+8上午4時06分31秒寫道:
 Steven D'Aprano wrote:
 
  Sent: Thursday, October 04, 2012 7:22 PM
 
  To: python-list@python.org
 
  Subject: Re: notmm is dead!
 
  
 
  On Thu, 04 Oct 2012 14:10:46 -0400, Etienne Robillard wrote:
 
  
 
   Dear list,
 
  
 
   Due to lack of energy and resources i'm really sad to announce the
 
   removal of notmm from pypi and bitbucket.
 
  
 
  Well that's just rude. Even if you don't intend to maintain the software
 
  any more, why are you removing it from pypi? Since you say you are a fan
 
  of Open Source software, just flag it as unmaintained and leave it for
 
  somebody else to pick up.
 
  
 
  If you are going to abandon the project, release it on PyPI with a dual
 
  MIT and GPL licence, and let it be taken over by somebody else.
 
  
 
  If you were looking for sympathy here, starting off by removing your
 
  project from free hosting, then complaining that you can't pay for the
 
  non-free hosting, was NOT the right way to do so.
 
 
 
 I might be misunderstanding, but I think Etienne wants money in 
 
 exchange for letting someone else take over. 
 
 
 
  
 
  By the way, the latest version of notmm (0.4.4) has an empty licence
 
  file. No licence means that everyone using it is unlicenced and therefore
 
  infringing your copyright.
 
  
 
  
 
 
 
 
 
 This email is confidential and subject to important disclaimers and
 
 conditions including on offers for the purchase or sale of
 
 securities, accuracy and completeness of information, viruses,
 
 confidentiality, legal privilege, and legal entity disclaimers,
 
 available at http://www.jpmorgan.com/pages/disclosures/email.

I think it is OK to have some string attatched in those open source projects.

Nowadays the software industry is just like the perfume and prtinting 
and the audio-video entaertainment   industry.

The replication cost is so  low. Don't forget the lawsuites in Facebook 
about  the participants charged the founder in the courts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: calendar from python to html

2012-10-05 Thread Jason Benjamin
Well, you need a web server, a webpage, a database (could just be a 
file), a cgi script, and the datetime module.  Optionally, you can use a 
web framework like CherryPy or Django, which covers a lot of these by 
itself.


I only know Python 2, but here are some examples:

A basic web server:

webdir = '.'
port = 80

import os, sys
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler

if len(sys.argv)  1: webdir = sys.argv[1]
if len(sys.argv)  2: port = int(sys.argv[2])
print 'webdir %s, port %s' % (webdir, port)

#Windows only hack
if sys.platform[:3] == 'win':
CGIHTTPRequestHandler.have_popen2 = False
CGIHTTPRequestHandler.have_popen3 = False
sys.path.append('cgi-bin')

os.chdir(webdir)
srvraddr = (, port)
srvrobj = HTTPServer(srvraddr, CGIHTTPRequestHandler)
srvrobj.serve_forever()


Start the script in the same directory as the cgi script and HTML.
Assuming you have a file that holds '1' time per date, you could
write a program to pickle and unpickle dictionaries that
are derived from form data:

import pickle
import cgi

file = open('dates.pkl', 'rb')
mydates = pickle.load(file)
file.close()

html = 
html
body
h1Schedule/h1
form method=POST action=yourscript.py
table border=1
tr
tdinput type=text name=april01 value=%(april01)s/td
tdinput type=text name=april02 value=%(april02)s/td
/tr
tr
tdinput type=text name=april03 value=%(april03)s/td
tdinput type=text name=april04 value=%(april04)s/td
/tr
/table
input type=hidden name=submitted value=done
pinput type=submit
/form
/body
/html


dates = ['april01', 'april02', 'april03', 'april04']
if form.has_key('submitted'):
newdates = {}
for d in dates:
if form.has_key(d):
newdates[d] = form[d].value
else:
newdates[d] = ''
mydates = newdates
output = open('dates.pkl', 'wb')
pickle.dump(mydates, output)
output.close()
else:
for d in dates:
if not mydates.has_key(d):
mydates[d] = ''

print html % mydates


Then you could write an additional program that runs
in the background or something:

import pickle
from datetime import date, datetime

mycode = 'print Hello World!'
file = open('dates.pkl', 'rb')
mydates = pickle.load(file)
file.close()

while True:
today = date.today()
if today.month == 4 and today.day == 01:
hour = datetime.time(datetime.now()).hour
min = datetime.time(datetime.now()).minute
if hour == int(mydates['april04'][0]) and min ==
int(mydates['april04'][-2:]):
exec mycode

_exec_ executes a Python string like a program.  To execute an actual 
python script use subprocess instead:


import subprocess
subprocess.call([python, myscript.py])

Hope this helps.

On 10/05/2012 11:55 AM, Luca Sanna wrote:

hi,

I enter a calendar in an html page
in each calendar day, I enter a time that is used by the program to perform 
actions with python

What can I use to do this?

thanks



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


Re: notmm is dead!

2012-10-05 Thread Michael Torrie
On 10/05/2012 07:43 PM, 8 Dihedral wrote:
 I think it is OK to have some string attatched in those open source projects.

What are you talking about?  What string?

 Nowadays the software industry is just like the perfume and prtinting 
 and the audio-video entaertainment   industry.

True

 The replication cost is so  low. Don't forget the lawsuites in Facebook 
 about  the participants charged the founder in the courts.

What do lawsuits have to do with replication costs?

I suppose a person can fail a turing test...
-- 
http://mail.python.org/mailman/listinfo/python-list


write binary with struct.pack_into

2012-10-05 Thread palmeira
Dear pythonists,

I'm having a problem with read/write binary in python.
I have a binary file that I need to read information, extract a array,
modify this array and put these values into file again in same binary
format.
I need to use unpack_from and pack_into because sometimes gonna need
read/write in the middle of file.

Script:

import struct
bloco='%df' %(252)  #Binary format

# READ
fa=open('testIN.bin')
my_array=struct.unpack_from(bloco,fa.read()[0*4:251*4])# my_aray = 252
elements array
## This read is OK!

#WRITE
fb=open('testOUT.bin')
test=struct.pack_into(bloco,fb.write()[0*4:251*4])  # ERROR in this WRITE




Regards,

Ronaldo Palmeira.




--
View this message in context: 
http://python.6.n6.nabble.com/write-binary-with-struct-pack-into-tp4991234.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: write binary with struct.pack_into

2012-10-05 Thread 88888 Dihedral
palmeira於 2012年10月6日星期六UTC+8上午11時27分47秒寫道:
 Dear pythonists,
 
 
 
 I'm having a problem with read/write binary in python.
 
 I have a binary file that I need to read information, extract a array,
 
 modify this array and put these values into file again in same binary
 
 format.
 
 I need to use unpack_from and pack_into because sometimes gonna need
 
 read/write in the middle of file.
 
 
 
 Script:
 
 
 
 import struct
 
 bloco='%df' %(252)  #Binary format
 
 
 
 # READ
 
 fa=open('testIN.bin')
 
 my_array=struct.unpack_from(bloco,fa.read()[0*4:251*4])# my_aray = 252
 
 elements array
 
 ## This read is OK!
 
 
 
 #WRITE
 
 fb=open('testOUT.bin')
 
 test=struct.pack_into(bloco,fb.write()[0*4:251*4])  # ERROR in this WRITE
 
 
 
 
 
 
 
 
 
 Regards,
 
 
 
 Ronaldo Palmeira.
 
 
 
 
 
 
 
 
 
 --
 
 View this message in context: 
 http://python.6.n6.nabble.com/write-binary-with-struct-pack-into-tp4991234.html
 
 Sent from the Python - python-list mailing list archive at Nabble.com.

Are you writing and reading files produce by different 
languages?

The pickle part  is better  for OOP and glue logics in python.

The heavy computing part should be done in CYTHON.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: notmm is dead!

2012-10-05 Thread Ramchandra Apte
On Saturday, 6 October 2012 08:29:02 UTC+5:30, Michael Torrie  wrote:
 On 10/05/2012 07:43 PM, 8 Dihedral wrote:
 
  I think it is OK to have some string attatched in those open source 
  projects.
 
 
 
 What are you talking about?  What string?
 
 
 
  Nowadays the software industry is just like the perfume and prtinting 
 
  and the audio-video entaertainment   industry.
 
 
 
 True
 
 
 
  The replication cost is so  low. Don't forget the lawsuites in Facebook 
 
  about  the participants charged the founder in the courts.
 
 
 
 What do lawsuits have to do with replication costs?
 
 
 
 I suppose a person can fail a turing test...

You are talking to a bot.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue16112] platform.architecture does not correctly escape argument to /usr/bin/file

2012-10-05 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Jesús Cea Avión wrote:
 
 Jesús Cea Avión added the comment:
 
 Thanks for the heads-up, Victor.
 
 I have added Marc-Andre Lemburg to the nosy list, so he can know about this 
 issue and can provide feedback (or request a backout for 2.7).
 
 Marc-Andre?.

The comment that Viktor posted still stands for Python 2.7.

You can use subprocess in platform for Python 2.7, but only if
it's available. Otherwise the module must fall back to the
portable popen() that comes with the platform module.

It may be worth adding that selection process to the popen()
function in platform itself.

For Python 3.x, you can use subprocess.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 05 2012)
 Python Projects, Consulting and Support ...   http://www.egenix.com/
 mxODBC.Zope/Plone.Database.Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2012-09-27: Released eGenix PyRun 1.1.0 ...   http://egenix.com/go35
2012-09-26: Released mxODBC.Connect 2.0.1 ... http://egenix.com/go34
2012-09-25: Released mxODBC 3.2.1 ... http://egenix.com/go33
2012-10-23: Python Meeting Duesseldorf ... 18 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--

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



[issue11678] Add support for Arch Linux to platform.linux_distributions()

2012-10-05 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Éric Araujo wrote:
 
 Éric Araujo mer...@netwok.org added the comment:
 
 Feature freeze just came by; sorry we missed this.
 
 Given our recent-ish discussion about additions to mimetypes (and the 
 consensus (IIRC) that matching the IANA database can be considered a bug 
 fix), I wonder if detecting more OSes in platform should be considered a new 
 feature.  On one end we have mimetypes when there is just a dictionary update 
 with no risk, on the other end we have ports to new OSes which clearly are 
 new features; I think platform is on the fence, maybe just a bit on the new 
 feature side.

I'm fine with adding new OS support to platform in bugfix releases.

The idea is to support as many platforms as possible and if a popular
one is missing, that's a bug.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 05 2012)
 Python Projects, Consulting and Support ...   http://www.egenix.com/
 mxODBC.Zope/Plone.Database.Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2012-09-27: Released eGenix PyRun 1.1.0 ...   http://egenix.com/go35
2012-09-26: Released mxODBC.Connect 2.0.1 ... http://egenix.com/go34
2012-09-25: Released mxODBC 3.2.1 ... http://egenix.com/go33
2012-10-23: Python Meeting Duesseldorf ... 18 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--

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



[issue16112] platform.architecture does not correctly escape argument to /usr/bin/file

2012-10-05 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

 The implementation of platform.architecture shells out to the file command. 
 It tries to escape quotes by replacing  with \, but that's not sufficient.
 
 $ python3.2 -c 'import platform; platform.architecture(foo\\\; echo Hi 
 there  /tmp/Z; echo \\\)'  cat /tmp/Z
 Hi there
 
 Here's a patch to make it use subprocess instead. I haven't tested it 
 thoroughly building everything from trunk and running tests, but I verified 
 it works by replacing the platform.py in my system Python install.

I think a much better patch would be to test for existence of the
file in question. File names rarely use any of the mentioned quoting
and most certainly not for an executable, so if the check fails, that's
a good indication that something is not right.

Perhaps such a check could be added in addition to the other things
in the patch ?

BTW: It's probably better to discuss such patches on the tracker first,
before applying them to the code base. It becomes difficult discussing
patches that have already been partially applied to the code.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 05 2012)
 Python Projects, Consulting and Support ...   http://www.egenix.com/
 mxODBC.Zope/Plone.Database.Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2012-09-27: Released eGenix PyRun 1.1.0 ...   http://egenix.com/go35
2012-09-26: Released mxODBC.Connect 2.0.1 ... http://egenix.com/go34
2012-09-25: Released mxODBC 3.2.1 ... http://egenix.com/go33
2012-10-23: Python Meeting Duesseldorf ... 18 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-10-05 Thread Gregory P. Smith

New submission from Gregory P. Smith:

Ben Leslie writes this on python-dev:

Hi all,

I have a Python program where I have many threads each calling Popen, and I was 
hitting some trouble.

I've been seeing this on 3.2.3, however I believe the same issue is still 
potentially a problem on head.

The error manifests itself when a call to os.close(errpipe_read) fails with 
EBADF 
(http://hg.python.org/releasing/3.2.3/file/86d1421a552c/Lib/subprocess.py#l1314)

I believe the root cause of this problem is due to a double close() on a 
different file descriptor (which is then reused as errpipe_read).

The file descriptors: p2cwrite, c2pread and errread are all closed at the end 
of the _execute_child method:

http://hg.python.org/releasing/3.2.3/file/86d1421a552c/Lib/subprocess.py#l1351

However, these filedescriptors are wrapped up into file objects during __init__ 
(see: 
http://hg.python.org/releasing/3.2.3/file/86d1421a552c/Lib/subprocess.py#l725)

As far as I can tell at the point where the garbage collector kicks in  
Popen.{stdin,stdout,stderr} all go out of scope, and will be deallocated, and 
the underlying filedescriptor closed.

However because the filedescriptor is already closed, and by this time is 
actually reused, this deallocation closes what ends up being an incorrect 
file-descriptor.

Since closing a file object where the underlying fd is already closed is 
silenced 
(http://hg.python.org/releasing/3.2.3/file/86d1421a552c/Modules/_io/iobase.c#l235)
 this would not normally be very apparent.

This race between a new filedescriptor being allocated and the garbage 
collector deallocating the file descriptors certainly hits when using a few 
threads, but I guess depending on the exact behaviour of the garbage collector 
it could potentially also occur in a single threaded case as well.

I think a fix would be to remove the explicit close of these file descriptors 
at the end of _execute_child, and let the garbage collector close them. Of 
course that may leak file descriptors, if the GC doesn't kick in for a while, 
so the other option would be to close the file object, rather than just the 
file descriptor.

Hopefully someone more intimately familiar with the module can point me in the 
right direction to verify this, and provide a fix.

Thanks,

Benno

--
assignee: gregory.p.smith
messages: 172053
nosy: gregory.p.smith
priority: high
severity: normal
stage: test needed
status: open
title: subprocess.Popen the os.close calls in _execute_child can raise an EBADF 
exception
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-10-05 Thread Ross Lagerwall

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


--
nosy: +rosslagerwall

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



[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.

2012-10-05 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

 IMHO either of these solutions would be fine.
 
 * have a PyOS_PutEnv() function, gettext has gettext_putenv() to
 workaround this problem.

This solution would help in many other cases as well, so adding
such an API would certainly help more than specialized interfaces.

 * manage this the same as Py_GetPythonHome(), which can be defined by
 the embedding application to override the default.

I think you meant Py_SetPythonHome().

Given that the IO encoding is very important for Python 3.x, a special
API just for setting the encoding may be useful to have as well.

Care must be taken, though, that the encoding cannot be set after
Py_Initialize() has been called.

It may overall be easier to go with the PyOS_PutEnv() solution to
not run into the problems with having to check for an initialized
interpreter first.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 05 2012)
 Python Projects, Consulting and Support ...   http://www.egenix.com/
 mxODBC.Zope/Plone.Database.Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2012-09-27: Released eGenix PyRun 1.1.0 ...   http://egenix.com/go35
2012-09-26: Released mxODBC.Connect 2.0.1 ... http://egenix.com/go34
2012-09-25: Released mxODBC 3.2.1 ... http://egenix.com/go33
2012-10-23: Python Meeting Duesseldorf ... 18 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--

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



[issue16112] platform.architecture does not correctly escape argument to /usr/bin/file

2012-10-05 Thread STINNER Victor

STINNER Victor added the comment:

1.7 -with open(DEV_NULL) as dev_null:
 1.8 -proc = subprocess.Popen(['file', '-b', '--', target],
 1.9 -stdout=subprocess.PIPE,
stderr=dev_null)
 1.9 +proc = subprocess.Popen(['file', target],
1.10 +stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

Errors should be ignored, not written into stderr. subprocess.DEVNULL
was added to Python 3.3, in older version you have to manually call
open the DEV_NULL file.

(Oh by the way, it should be opened in write mode for stderr, not in
read mode!?)

--

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-10-05 Thread Gregory P. Smith

Gregory P. Smith added the comment:

What you've described makes sense.

The file descriptors are indeed conditionally wrapped in file objects using 
io.open which could lead to a double close in the error case in a threaded 
application.  yuck.

1) The code needs to check if the fd was wrapped before calling os.close() on 
it. It could do this by checking the sys.stdin, sys.stdout and sys.stderr 
attributes respectively for each fd.

2) another option that is a little more clear code wise as it doesn't try to 
use an implied connection between the stdin/stdout/strerr attributes would be 
to _always_ wrap the fd's that this can happen to in an io object (regardless 
of if they've been assigned to the stdin/stdout/stderr attributes) and pass 
those to _execute_child.  Their .fileno() method can be used for the value to 
pass to _posixsubprocess.fork_exec().  And the os.close on those would turn 
into a close method call which won't allow double close EBADF errors.

--

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



[issue16112] platform.architecture does not correctly escape argument to /usr/bin/file

2012-10-05 Thread STINNER Victor

STINNER Victor added the comment:

 You can use subprocess in platform for Python 2.7, but only if
 it's available. Otherwise the module must fall back to the
 portable popen() that comes with the platform module.

Marc-Andre: I still don't understand why you want to run platform.py
of Python 2.7 on older Python version? How does it happen? I expected
Python 2.3 to use its own version of platform.py.

--

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



[issue16112] platform.architecture does not correctly escape argument to /usr/bin/file

2012-10-05 Thread STINNER Victor

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


--
resolution: fixed - 
status: closed - open

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



[issue16109] urllib2.urlopen throws HTTP Error in python 2.7.2, 2.7.3, but not in python 2.7

2012-10-05 Thread Christian Fertig

Christian Fertig added the comment:

ok, here's a run with debuglevel for the headers:

python 2.7 on openSuSE 11.4:

fertig@hornisse:/home/fertig  python
Python 2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC] on linux2
Type help, copyright, credits or license for more information.
 import urllib2
 request = urllib2.Request('https://172.23.6.222')
 opener = urllib2.build_opener(urllib2.HTTPSHandler(debuglevel=111))
 feeddata = opener.open(request).read()
send: 'GET / HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: 
172.23.6.222\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Fri, 05 Oct 2012 09:46:33 GMT
header: Server: Virata-EmWeb/R6_2_0
header: Connection: close
header: Transfer-Encoding: chunked
header: Content-Type: text/html
header: Expires: Fri, 05 Oct 2012 09:46:33 GMT
header: Last-Modified: Fri, 05 Oct 2012 09:46:33 GMT
header: Cache-Control: no-cache


python 2.7.2 on openSuSE 12.1:

fertig@wespe:/home/fertig  python
Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2
Type help, copyright, credits or license for more information.
 import urllib2
 request = urllib2.Request('https://172.23.6.222')
 opener = urllib2.build_opener(urllib2.HTTPSHandler(debuglevel=111))
 feeddata = opener.open(request).read()
urllib2.Request instance at 0x90d878
send: 'GET / HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: 
172.23.6.222\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\n\r\n'
reply: 'HTTP/1.1 405 Method Not Allowed\r\n'
header: Date: Fri, 05 Oct 2012 09:44:11 GMT
header: Server: Virata-EmWeb/R6_2_0
header: Connection: close
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib64/python2.7/urllib2.py, line 401, in open
response = meth(req, response)
  File /usr/lib64/python2.7/urllib2.py, line 514, in http_response
'http', request, response, code, msg, hdrs)
  File /usr/lib64/python2.7/urllib2.py, line 439, in error
return self._call_chain(*args)
  File /usr/lib64/python2.7/urllib2.py, line 372, in _call_chain
result = func(*args)
  File /usr/lib64/python2.7/urllib2.py, line 522, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 405: Method Not Allowed


--

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



[issue16109] urllib2.urlopen throws HTTP Error in python 2.7.2, 2.7.3, but not in python 2.7

2012-10-05 Thread Christian Fertig

Christian Fertig added the comment:

the IP is private and even for testing I can't put it in a public IP range, as 
the device is an IP Phone with a custom firmware (Siemens optiPoint 420).

--

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



[issue16123] IDLE - deprecate running without a subprocess

2012-10-05 Thread Ned Deily

Ned Deily added the comment:

A popup menu on every invocation of IDLE would be a very user-unfriendly thing 
to do.  If it's possible that a print to stderr might not be visible to a user, 
another solution might be to use the approach in Lib/idlelib/macosxSupport.py 
tkVersionWarning which causes the warning message to show up in the PyShell 
window.

--

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



[issue16136] Removal of VMS support

2012-10-05 Thread Charles-François Natali

Charles-François Natali added the comment:

 After the blog post, Mathew, Sandeep from HP asked how to help:

It was more than a year ago.
Has something actually be done?

--
nosy: +neologix

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



[issue16139] Python 3.3 fails when starting from read-only FS

2012-10-05 Thread Richard Oudkerk

Richard Oudkerk added the comment:

This is more or less a duplicate of #15833 (although the errno mentioned there 
is EIO instead of the more sensible EROFS).

--
nosy: +sbt

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



[issue16116] Can not install C extension modules to inside a venv on Python 3.3.0 for Win32

2012-10-05 Thread Masami HIRATA

Masami HIRATA added the comment:

I have tested the workaround and it works correctly.
Please see attached log file.

--
Added file: http://bugs.python.org/file27429/Python33_with_venv_2.txt

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



[issue8800] add threading.RWLock

2012-10-05 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

Thanks Richard.
I wonder if the issues with the multiprocessing tests can be fixed by making 
use of Barriers?

One of the reasons I introduced Barriers into the lib originally was my alarm 
at seeing the various springklings of different _wait() calls in the unittests, 
particularly in the threading module (there are Condition variable tests there 
still that have race conditions, that are cunnrently hidden by liberal use of 
_wait())

Then I started to wonder if it were appropriate to use a Barrier in the 
Condition variable tests, particularly given that the former is implemented by 
way of the latter :)

--

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



[issue8800] add threading.RWLock

2012-10-05 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

 although I'd prefer a BSD errno example, such as ECONNRESET, instead of a 
 winsock one
Are you referring to the comment where I mention ECONNABORTED?  That is a 
regular unix error (windows version is WSAECONNABORTED).
This error occurs when the local stack decides to kill the connection, as 
opposed to ECONNRESET which occurs on account of receiving a RST packet.

New patch includes documentation change.

If 2.7 is still in bugfix mode, then this patch could probably be accepted.

--
Added file: http://bugs.python.org/file27430/socketserver.patch

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



[issue16138] In the glossary there is a small typo about __len__() in the sequence definition

2012-10-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7cf0d8b2744b by Andrew Svetlov in branch '3.2':
Issue #16138: fix typo.
http://hg.python.org/cpython/rev/7cf0d8b2744b

New changeset a093d39fdda4 by Andrew Svetlov in branch '3.3':
Merge issue #16138: fix typo.
http://hg.python.org/cpython/rev/a093d39fdda4

New changeset cbb9b5dcb88a by Andrew Svetlov in branch 'default':
Merge issue #16138: fix typo.
http://hg.python.org/cpython/rev/cbb9b5dcb88a

--
nosy: +python-dev

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



[issue16116] Can not install C extension modules to inside a venv on Python 3.3.0 for Win32

2012-10-05 Thread Masami HIRATA

Masami HIRATA added the comment:

btw, it seems to me that -IC:\Python33\include -IC:\Python33\include should 
be -IC:\Users\msmhrt\mypython\3.3.0\include -IC:\Python33\include.
What do you think about it?

--

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



[issue16138] In the glossary there is a small typo about __len__() in the sequence definition

2012-10-05 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Fixed. Thanks to py.user

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

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



  1   2   3   >