ANN: Spyder v2.1.11

2012-07-29 Thread Pierre Raybaut
Hi all,

On the behalf of Spyder's development team
(http://code.google.com/p/spyderlib/people/list), I'm pleased to
announce that Spyder v2.1.11 has been released and is available for
Windows XP/Vista/7, GNU/Linux and MacOS X:
http://code.google.com/p/spyderlib/

This is a pure maintenance release -- a lot of bugs were fixed since v2.1.10:
http://code.google.com/p/spyderlib/wiki/ChangeLog

Spyder is a free, open-source (MIT license) interactive development
environment for the Python language with advanced editing, interactive
testing, debugging and introspection features. Originally designed to
provide MATLAB-like features (integrated help, interactive console,
variable explorer with GUI-based editors for dictionaries, NumPy
arrays, ...), it is strongly oriented towards scientific computing and
software development.
Thanks to the `spyderlib` library, Spyder also provides powerful
ready-to-use widgets: embedded Python console (example:
http://packages.python.org/guiqwt/_images/sift3.png), NumPy array
editor (example: http://packages.python.org/guiqwt/_images/sift2.png),
dictionary editor, source code editor, etc.

Description of key features with tasty screenshots can be found at:
http://code.google.com/p/spyderlib/wiki/Features

On Windows platforms, Spyder is also available as a stand-alone
executable (don't forget to disable UAC on Vista/7). This all-in-one
portable version is still experimental (for example, it does not embed
sphinx -- meaning no rich text mode for the object inspector) but it
should provide a working version of Spyder for Windows platforms
without having to install anything else (except Python 2.x itself, of
course).

Don't forget to follow Spyder updates/news:
 * on the project website: http://code.google.com/p/spyderlib/
 * and on our official blog: http://spyder-ide.blogspot.com/

Last, but not least, we welcome any contribution that helps making
Spyder an efficient scientific development/computing environment. Join
us to help creating your favourite environment!
(http://code.google.com/p/spyderlib/wiki/NoteForContributors)

Enjoy!
-Pierre
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


PyCon UK Call for Papers

2012-07-29 Thread Michael Foord
PyCon UK 2012, the UK's official Python conference, returns from the 28th 
September to 1st October, Coventry UK.

http://www.pyconuk.org/

This volunteer run and organised conference includes sprints, training, open 
space and social events. For more information please see our site at 
pyconuk.org and our wiki at pyconuk.net

If you would like to share your expertise, tell us your horror stories or pimp 
your project, please consider giving a talk at PyConUK.

Your talk should reflect at least one of our four themes ( 
http://pyconuk.net/Themes ).

When planning your talk, it should be no more than 40 minutes.

Please email us the following:

Your name
A contact number
A one paragraph biography
The title of your talk
A short one paragraph abstract
Which theme (or themes) your talk can be categorised under.

If we accept your talk, we would also require a longer abstract in order to 
create a wiki page.

To submit a talk, please email sub...@pyconuk.net before Tuesday 14th August 
2012.

If you have already given us your talks, and had confirmation from John or 
Zeth, then ignore this message, but we still need the data in the wiki if it is 
not already there.

Best Wishes,
PyCon UK Team
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: OT: Text editors

2012-07-29 Thread Ben Finney
rusi rustompm...@gmail.com writes:

 Do you use the emacs builtin python mode or the separate python-mode?

I'm not sure. I have both installed.

I try to keep my Emacs setup portable across different machines, so I'm
probably using the built-in mode.

 Do you use pdb?

Occasionally, but I haven't learned how to do that in Emacs.

 Any other special setups?

GNU Screen and Emacs are the foundation of my programming environment.

 How about ipython?

Never really liked it nor saw a need for it. I use the Python
interactive console, with GNU readline so I get history preserved and
tab-completion.

 But I am getting increasing 'funny looks' for not (for example) using
 eclipse.]

Unless those funny looks are accompanied by compelling reasons to invest
a whole lot of effort into learning a rather slow and complex program,
then it seems you can ignore them.

-- 
 \  “The way to build large Python applications is to componentize |
  `\ and loosely-couple the hell out of everything.” —Aahz |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Text editors

2012-07-29 Thread Mark Lawrence

On 29/07/2012 06:08, Ben Finney wrote:

Tim Chase python.l...@tim.thechases.com writes:


On Sat, Jul 28, 2012 at 6:29 PM, Mark Lawrence wrote:

I highly recommend the use of notepad++.  If anyone knows of a
better text editor for Windows please let me know :)


I highly recommend not tying your editor skills to a single OS,
especially one as ornery for programmers as Windows.


I'll advocate for Vim which is crazy-powerful and works nicely on
just about any platform I touch.

Others will advocate for Emacs, which I can't say fits the way my
brain works but it's also powerful and loved by many.


Right. I'm in Tim's position, but reversed: my preference is for Emacs
but Vim is a fine choice also. They are mature, well-supported with
regular updates and a massive library of plug-ins for different uses,
have a huge community to help you, and work on all major programming
OSen.


The ubiquity of these two platforms makes a worthwhile investment of
time spent in learning at least one if not both.


I use both frequently in my work for different things, and they are good
for pretty much any task involving manipulation of text.

Learn one of Emacs or Vim well, and you won't need to worry about text
editors again.



Point taken, snag being I've never used any nix box in anger.  This 
thread reminds of the good 'ole days when I were a lad using TPU on VMS. 
 Have we got any VMS aficionados here?


--
Cheers.

Mark Lawrence.

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


Python Error

2012-07-29 Thread subhabangalore
Dear Group,

I was trying to convert the list to a set, with the following code:

set1=set(list1)

the code was running fine, but all on a sudden started to give the following 
error,

set1=set(list1)
TypeError: unhashable type: 'list'

please let me know how may I resolve.

And sometimes some good running program gives error all on a sudden with no 
parameter changed, how may I debug it?

Thanking You in Advance,

Regards,
Subhabrata Banerjee. 

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


Re: Python Error

2012-07-29 Thread Peter Otten
subhabangal...@gmail.com wrote:

 Dear Group,
 
 I was trying to convert the list to a set, with the following code:
 
 set1=set(list1)
 
 the code was running fine, but all on a sudden started to give the
 following error,
 
 set1=set(list1)
 TypeError: unhashable type: 'list'
 
 please let me know how may I resolve.
 
 And sometimes some good running program gives error all on a sudden with
 no parameter changed, how may I debug it?

Add a print statement before the offending line:

print list1
set1 = set(list1)

You will see that list1 contains another list, e. g. this works...

 list1 = [alpha, beta]   
 
   
 set(list1)  
 
   
set(['alpha', 'beta'])  

  

...while this doesn't:

 list1 = [alpha, [beta]] 
 
   
 set(list1)  
 
  
Traceback (most recent call last):  

  
  File stdin, line 1, in module   

  
TypeError: unhashable type: 'list'  

  

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


Re: OT: Text editors

2012-07-29 Thread Tim Chase
On 07/29/12 05:28, Mark Lawrence wrote:
 On 29/07/2012 06:08, Ben Finney wrote:
 Tim Chase python.l...@tim.thechases.com writes:
 Learn one of Emacs or Vim well, and you won't need to worry
 about text editors again.
 
 Point taken, snag being I've never used any nix box in anger.
 This thread reminds of the good 'ole days when I were a lad using
 TPU on VMS. Have we got any VMS aficionados here?

Though I'm personally far more vitriolic about VMS vs $OS (had a few
souring experiences with VMS in college) than I am regarding Vim vs.
Emacs, you can get Vim for at least OpenVMS:

http://www.vim.org/download.php#others

I presume sources compile fairly well on other flavors of VMS if
needed, and I'd expect Emacs can do likewise[1]

-tkc


[1]
http://www.emacswiki.org/emacs/EmacsOnVMS
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Error

2012-07-29 Thread subhabangalore
On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote:
 Dear Group,
 
 
 
 I was trying to convert the list to a set, with the following code:
 
 
 
 set1=set(list1)
 
 
 
Dear Peter,
Thanks for the answer. But my list does not contain another list that is the 
issue. Intriguing. Thinking what to do. 
Regards,
Subhabrata. 
 the code was running fine, but all on a sudden started to give the following 
 error,
 
 
 
 set1=set(list1)
 
 TypeError: unhashable type: 'list'
 
 
 
 please let me know how may I resolve.
 
 
 
 And sometimes some good running program gives error all on a sudden with no 
 parameter changed, how may I debug it?
 
 
 
 Thanking You in Advance,
 
 
 
 Regards,
 
 Subhabrata Banerjee.

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


Re: Python Error

2012-07-29 Thread Thomas Jollans
On 07/29/2012 02:30 PM, subhabangal...@gmail.com wrote:
 Thanks for the answer. But my list does not contain another list that is the 
 issue. Intriguing. Thinking what to do. 

What does your list contain? Can you reproduce the issue in a few
self-contained lines of code that you can show us, that we can test
ourselves?

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


Re: Python Error

2012-07-29 Thread Ifthikhan Nazeem
Hi,

Have you tried printing the list which is passed onto the set. The items in
the list passed should be hashable and possibly there are objects which are
not hashable.

On Sun, Jul 29, 2012 at 2:30 PM, subhabangal...@gmail.com wrote:

 On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote:
  Dear Group,
 
 
 
  I was trying to convert the list to a set, with the following code:
 
 
 
  set1=set(list1)
 
 
 
 Dear Peter,
 Thanks for the answer. But my list does not contain another list that is
 the issue. Intriguing. Thinking what to do.
 Regards,
 Subhabrata.
  the code was running fine, but all on a sudden started to give the
 following error,
 
 
 
  set1=set(list1)
 
  TypeError: unhashable type: 'list'
 
 
 
  please let me know how may I resolve.
 
 
 
  And sometimes some good running program gives error all on a sudden with
 no parameter changed, how may I debug it?
 
 
 
  Thanking You in Advance,
 
 
 
  Regards,
 
  Subhabrata Banerjee.

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

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


Re: OT: Text editors

2012-07-29 Thread Robert Marshall
On Sun, 29 Jul 2012, python.l...@tim.thechases.com wrote:

 On 07/29/12 05:28, Mark Lawrence wrote:
 On 29/07/2012 06:08, Ben Finney wrote:
 Tim Chase python.l...@tim.thechases.com writes:
 Learn one of Emacs or Vim well, and you won't need to worry
 about text editors again.
 
 Point taken, snag being I've never used any nix box in anger.
 This thread reminds of the good 'ole days when I were a lad using
 TPU on VMS. Have we got any VMS aficionados here?
 
 Though I'm personally far more vitriolic about VMS vs $OS (had a few
 souring experiences with VMS in college) than I am regarding Vim vs.
 Emacs, you can get Vim for at least OpenVMS:
 
 http://www.vim.org/download.php#others
 
 I presume sources compile fairly well on other flavors of VMS if
 needed, and I'd expect Emacs can do likewise[1]
 

I used to use tpu (used to have piles of tpu macros..) and I first got used
to emacs by using its tpu mode - I see that still exists so you can use
emacs and pretend it is really tpu!

Robert
-- 
La grenouille songe..dans son château d'eau
Links and things http://rmstar.blogspot.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Error

2012-07-29 Thread Mark Lawrence

On 29/07/2012 13:30, subhabangal...@gmail.com wrote:

On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote:

Dear Group,

I was trying to convert the list to a set, with the following code:

set1=set(list1)


Dear Peter,
Thanks for the answer. But my list does not contain another list that is the 
issue. Intriguing. Thinking what to do.
Regards,
Subhabrata.


Can you loop round the list and print each entry and its type, that 
should give you some clues?



the code was running fine, but all on a sudden started to give the following 
error,

set1=set(list1)

TypeError: unhashable type: 'list'

please let me know how may I resolve.

And sometimes some good running program gives error all on a sudden with no 
parameter changed, how may I debug it?

Thanking You in Advance,

Regards,

Subhabrata Banerjee.





--
Cheers.

Mark Lawrence.

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


Re: Python Error

2012-07-29 Thread Steven D'Aprano
On Sun, 29 Jul 2012 05:30:15 -0700, subhabangalore wrote:

 Dear Peter,
 Thanks for the answer. But my list does not contain another list that is
 the issue. Intriguing. 

That is not what the error message says. You said that this line of code:

set1=set(list1)

gives this error:

TypeError: unhashable type: 'list'


Almost certainly, either you are mistaken about the line of code which 
gives the error, or you are mistaken about the error, or you are mistaken 
that your list does not contain any lists.


 Thinking what to do. 

Exactly what Peter suggested: print the list before you try to convert it 
to a set, and see what it actually contains.

It will also help you to read this page and try to follow its advice:

http://sscce.org/



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


newbie: write new file (from a server)

2012-07-29 Thread tokauf
Hi,

I have a client. He sends file content (as bytes) to my server. The server 
receives this content as bytes and decodes it to string. Then the server opens 
a file (filename comes from client) try to write the file-content to the new 
file.
It works but there are parts of the client file content in the new file.

I tested it: the whole content from client comes to the server.

Can anybody help me?

My server code:

-

import socketserver

class MyTCPServer(socketserver.BaseRequestHandler):

def handle(self):

s  = '' 
li = []
addr = self.client_address[0]
print([{}] Connected! .format(addr))
while True:

bytes = self.request.recv(4096)
if bytes:
s  = bytes.decode(utf8)
print(s)
li = s.split(~)
with open(li[0], 'w') as fp:
fp.write(li[1])

#... main ..

if __name__ == __main__:

server = socketserver.ThreadingTCPServer((, 12345), MyTCPServer)
server.serve_forever()




o-o

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


Re: OT: Text editors

2012-07-29 Thread Mark Lawrence

On 29/07/2012 14:36, Robert Marshall wrote:

On Sun, 29 Jul 2012, python.l...@tim.thechases.com wrote:


On 07/29/12 05:28, Mark Lawrence wrote:

On 29/07/2012 06:08, Ben Finney wrote:

Tim Chase python.l...@tim.thechases.com writes:
Learn one of Emacs or Vim well, and you won't need to worry
about text editors again.


Point taken, snag being I've never used any nix box in anger.
This thread reminds of the good 'ole days when I were a lad using
TPU on VMS. Have we got any VMS aficionados here?


Though I'm personally far more vitriolic about VMS vs $OS (had a few
souring experiences with VMS in college) than I am regarding Vim vs.
Emacs, you can get Vim for at least OpenVMS:

http://www.vim.org/download.php#others

I presume sources compile fairly well on other flavors of VMS if
needed, and I'd expect Emacs can do likewise[1]



I used to use tpu (used to have piles of tpu macros..) and I first got used
to emacs by using its tpu mode - I see that still exists so you can use
emacs and pretend it is really tpu!

Robert



Well knock me down with a feather, clevor Trevor[1], might have to give 
that a go, thanks.


[1] Ian Dury and the Blockheads album New Boots and Panties, song called 
Clevor Trevor for those of you who clearly lack a suitable education :)


--
Cheers.

Mark Lawrence.

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


newbie: write content in a file (server-side)

2012-07-29 Thread Thomas Kaufmann
Hi,

I send from a client file content to my server (as bytes). So far so good.
The server receives this content complete. Ok. Then I want to write this 
content to a new file. It works too. But in the new file are only the first 
part of the whole content.

What's the problem. 

o-o

Thomas

Here's my server code:



import socketserver

class MyTCPServer(socketserver.BaseRequestHandler):

def handle(self):

s  = '' 
li = []
addr = self.client_address[0]
print([{}] Connected! .format(addr))
while True:

bytes = self.request.recv(4096)
if bytes:
s  = bytes.decode(utf8)
print(s)
li = s.split(~)
with open(li[0], 'w') as fp:
fp.write(li[1])

#... main ..

if __name__ == __main__:

server = socketserver.ThreadingTCPServer((, 12345), MyTCPServer)
server.serve_forever()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Text editors

2012-07-29 Thread Arnaud Delobelle
On 29 July 2012 06:36, rusi rustompm...@gmail.com wrote:
 Just curious about your emacs+python usage.
 Do you use the emacs builtin python mode or the separate python-mode?
 Do you use pdb?
 Any other special setups?

One thing that I find very useful is to configure flymake to use
pyflakes.  Very useful to get feedback on unused imports / unused
variables / undefined variables (which means you spot typos on
variable names straight away).

For instructions, see e.g. http://www.plope.com/Members/chrism/flymake-mode

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


Re: Python Error

2012-07-29 Thread Roy Smith
In article 81818a9c-60d3-48da-9345-0c0dfd5b2...@googlegroups.com,
 subhabangal...@gmail.com wrote:

 set1=set(list1)
 
 the code was running fine, but all on a sudden started to give the following 
 error,
 
 set1=set(list1)
 TypeError: unhashable type: 'list'

First, make sure you understand what the error means.  All the elements 
of a set must be hashable.  Lists are not hashable because they are 
mutable.  So, what the error is telling you is that some element of 
list1 is itself a list, and therefore not hashable, and thus the set 
can't be created.

I would start by printing list1.  If the list is long (or contains 
deeply nested structures), just doing print list1 may result in 
something that is difficult to read.  In that case, try using pprint 
(see the pprint module) to get a nicer display.

If it's still not obvious, pull out the bigger guns.  Try something like:

for item in list1:
   try:
  hash(item)
   except TypeError:
  print This one can't be hashed: %s % item

 And sometimes some good running program gives error all on a sudden with no 
 parameter changed

Well, *something* changed.  Assuming nothing truly bizarre like a stray 
Higgs Boson flipping a bit in your computer's memory, what you need to 
do is figure out what that is.  Did you change your code in any way 
(having everything under version control helps here)?  If not the code, 
then what changed about the input?

If you're sure that both the code and the input are unchanged, that 
leaves something in the environment.  Did your python interpreter get 
upgraded to a newer version?  Or your operating system?  PYTHONPATH?

Depending on what your program is doing, it could be something time 
based.  A different time zone, perhaps?  Did daylight savings time just 
go into or out of effect where you are?  Does it only fail on Sunday?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Error

2012-07-29 Thread Jürgen A . Erhard
On Sun, Jul 29, 2012 at 01:08:57PM +0200, Peter Otten wrote:
 subhabangal...@gmail.com wrote:
 
  Dear Group,
  
  I was trying to convert the list to a set, with the following code:
  
  set1=set(list1)
  
  the code was running fine, but all on a sudden started to give the
  following error,
  
  set1=set(list1)
  TypeError: unhashable type: 'list'
  
 
 Add a print statement before the offending line:
 
 print list1
 set1 = set(list1)
 
 You will see that list1 contains another list, e. g. this works...
 

Peter's right, but instead of a print before the line, put a
try/except around it, like

   try:
  set1 = set(list1)
   except TypeError:
  print list1
  raise

This way, only the *actual* error triggers any output.  With a general
print before, you can get a lot of unnecessary output.

Grits, J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Error

2012-07-29 Thread subhabangalore
On Sunday, July 29, 2012 7:53:59 PM UTC+5:30, Roy Smith wrote:
 In article 81818a9c-60d3-48da-9345-0c0dfd5b2...@googlegroups.com,
 
  subhabangal...@gmail.com wrote:
 
 
 
  set1=set(list1)
 
  
 
  the code was running fine, but all on a sudden started to give the 
  following 
 
  error,
 
  
 
  set1=set(list1)
 
  TypeError: unhashable type: 'list'
 
 
 
 First, make sure you understand what the error means.  All the elements 
 
 of a set must be hashable.  Lists are not hashable because they are 
 
 mutable.  So, what the error is telling you is that some element of 
 
 list1 is itself a list, and therefore not hashable, and thus the set 
 
 can't be created.
 
 
 
 I would start by printing list1.  If the list is long (or contains 
 
 deeply nested structures), just doing print list1 may result in 
 
 something that is difficult to read.  In that case, try using pprint 
 
 (see the pprint module) to get a nicer display.
 
 
 
 If it's still not obvious, pull out the bigger guns.  Try something like:
 
 
 
 for item in list1:
 
try:
 
   hash(item)
 
except TypeError:
 
   print This one can't be hashed: %s % item
 
 
 
  And sometimes some good running program gives error all on a sudden with no 
 
  parameter changed
 
 
 
 Well, *something* changed.  Assuming nothing truly bizarre like a stray 
 
 Higgs Boson flipping a bit in your computer's memory, what you need to 
 
 do is figure out what that is.  Did you change your code in any way 
 
 (having everything under version control helps here)?  If not the code, 
 
 then what changed about the input?
 
 
 
 If you're sure that both the code and the input are unchanged, that 
 
 leaves something in the environment.  Did your python interpreter get 
 
 upgraded to a newer version?  Or your operating system?  PYTHONPATH?
 
 
 
 Depending on what your program is doing, it could be something time 
 
 based.  A different time zone, perhaps?  Did daylight savings time just 
 
 go into or out of effect where you are?  Does it only fail on Sunday?

Hi Roy,
Sorry I overlooked your answer. It fails generally on Sunday. True. How you got 
it? I recently downloaded Python2.7 64 bit -while I am working on Python3.2.1 
64 bit Windows 7 SP1. 
Regards,
Subhabrata Banerjee.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Error

2012-07-29 Thread Emile van Sebille

On 7/29/2012 5:30 AM subhabangal...@gmail.com said...

On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote:

Dear Group,
I was trying to convert the list to a set, with the following code:
set1=set(list1)

Thanks for the answer. But my list does not contain another list that is the 
issue. Intriguing. Thinking what to do.


Now you need to identify the type of the object that is causing python 
to misreport the unhashable type causing the error as the error you're 
getting says list and you say there isn't one.  So, now we have a python 
bug.


 set ([1,2,3])
set([1, 2, 3])
 set ([1,2,[]])
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unhashable type: 'list'
 set ([1,2,{}])
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unhashable type: 'dict'



 the code was running fine, but all on a sudden started to give the 
following error,




 set1=set(list1)

 TypeError: unhashable type: 'list'


Try adding the following:

for ii in list1:
try:
set([ii])
except:
print this causes an error type (val): %s (%s)  (type(ii),ii)


Either it's a python bug or there really is a list in there.

Emile


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


Re: Python Error

2012-07-29 Thread subhabangalore
On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote:
 Dear Group,
 
 
 
 I was trying to convert the list to a set, with the following code:
 
 
 
 set1=set(list1)
 
 
 
 the code was running fine, but all on a sudden started to give the following 
 error,
 
 
 
 set1=set(list1)
 
 TypeError: unhashable type: 'list'
 
 
 
 please let me know how may I resolve.
 
 
 
 And sometimes some good running program gives error all on a sudden with no 
 parameter changed, how may I debug it?
 
 
 
 Thanking You in Advance,
 
 
 
 Regards,
 
 Subhabrata Banerjee.

Dear Group,

Thank you for your kind time and reply. True as Steven pointed the error should 
be specific. I tested. Put comment mark before the set assignment, printed the 
list as Peter suggested, taken the print of the list, but no it is not my 
problem, as you suggested what is contained in the list, I am taking out the 
values and then assigning blank list and appending the processed values in the 
list. 
If this kind of problems happen, --rare but in my 6 yrs Python experience 
happened sometimes--then I take a new window, rewrite or copy the earlier code 
module by module, give a new method name--believe it or not--- works. 

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


Re: Python Error

2012-07-29 Thread Chris Angelico
On Mon, Jul 30, 2012 at 12:36 AM,  subhabangal...@gmail.com wrote:
 If this kind of problems happen, --rare but in my 6 yrs Python experience 
 happened sometimes--then I take a new window, rewrite or copy the earlier 
 code module by module, give a new method name--believe it or not--- works.

If that solves your problem, it may be that you inadvertently shadowed
a built-in - maybe you assigned to set or list or something.

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


Re: newbie: write content in a file (server-side)

2012-07-29 Thread Peter Otten
Thomas Kaufmann wrote:

 I send from a client file content to my server (as bytes). So far so good.
 The server receives this content complete. Ok. Then I want to write this
 content to a new file. It works too. But in the new file are only the
 first part of the whole content.
 
 What's the problem.

 Here's my server code:

 while True:
 bytes = self.request.recv(4096)
 if bytes:
 s  = bytes.decode(utf8)
 print(s)
 li = s.split(~)
 with open(li[0], 'w') as fp:
 fp.write(li[1])

- Do you ever want to leave the loop?

- You calculate a new filename on every iteration of the while loop -- 
probably not what you intended to do.

- The w argument tells Python to overwrite the file if it exists. You 
either need to keep the file open (move the with... out of the loop) or open 
it with a.

- You may not receive the complete file name on the first iteration of the 
while loop.

- The bytes buffer can contain incomplete characters, e. g.:

 data = b\xc3\xa4
 data.decode(utf-8)
'ä'
 data[:1].decode(utf-8)
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 0: 
unexpected end of data


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


Is Python a commercial proposition ?

2012-07-29 Thread lipska the kat

Pythoners

Firstly, thanks to those on the tutor list who answered my questions.

I'm trying to understand where Python fits into the set of commonly 
available, commercially used languages of the moment.


My most recent experience is with Java. The last project I was involved 
with included 6775 java source files containing 1,145,785 lines of code. 
How do I know this? because I managed to cobble together a python script 
that walks the source tree and counts the lines of code. It ignores 
block and line comments and whitespace lines so I'm fairly confident 
it's an accurate total. It doesn't include web interface files (mainly 
.jsp and HTML) or configuration files (XML, properties files and what 
have you). In fact it was remarkably easy to do this in python which got 
me thinking about how I could use the language in a commercial environment.


I was first attracted to python by it's apparent 'Object Orientedness' I 
soon realised however that by looking at it in terms of the language I 
know best I wasn't comparing like with like. Once I had 'rebooted the 
bioware' I tried to approach python with an open mind and I have to say 
it's growing on me.


The questions I have are ...

How is python used in the real world.
What sized projects are people involved with
Are applications generally written entirely in python or is it more 
often used for a subset of functionality.


I hope this is an acceptable question for this group

Many thanks

Lipska

--
Lipska the Kat: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
--
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Text editors

2012-07-29 Thread MRAB

On 29/07/2012 15:15, Mark Lawrence wrote:

On 29/07/2012 14:36, Robert Marshall wrote:

On Sun, 29 Jul 2012, python.l...@tim.thechases.com wrote:


On 07/29/12 05:28, Mark Lawrence wrote:

On 29/07/2012 06:08, Ben Finney wrote:

Tim Chase python.l...@tim.thechases.com writes:
Learn one of Emacs or Vim well, and you won't need to worry
about text editors again.


Point taken, snag being I've never used any nix box in anger.
This thread reminds of the good 'ole days when I were a lad using
TPU on VMS. Have we got any VMS aficionados here?


Though I'm personally far more vitriolic about VMS vs $OS (had a few
souring experiences with VMS in college) than I am regarding Vim vs.
Emacs, you can get Vim for at least OpenVMS:

http://www.vim.org/download.php#others

I presume sources compile fairly well on other flavors of VMS if
needed, and I'd expect Emacs can do likewise[1]



I used to use tpu (used to have piles of tpu macros..) and I first got used
to emacs by using its tpu mode - I see that still exists so you can use
emacs and pretend it is really tpu!

Robert



Well knock me down with a feather, clevor Trevor[1], might have to give
that a go, thanks.

[1] Ian Dury and the Blockheads album New Boots and Panties, song called
Clevor Trevor for those of you who clearly lack a suitable education :)


There appears to be some confusion about the spelling, but it might be
Clevor Trever.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-29 Thread Michael Hrivnak
http://www.djangosites.org/

Instagram, Pinterest, Washington Post, and The Onion all use djangoto
run their websites.

http://stackoverflow.com/questions/1906795/what-are-some-famous-websites-built-in-django

Django is of course a very highly-regarded web framework written in
python, but there are other good python frameworks out there with
strong user bases.

Python is used frequently on the server side of web applications for
sites of all sizes, with the UI generally being done in javascript.
It's also used heavily for administrative purposes such as:

- Operating system installer: http://fedoraproject.org/wiki/Anaconda
- Software repository management: http://pulpproject.org/
- Software package installation:
http://en.wikipedia.org/wiki/Ubuntu_Software_Center
- Cloud computing: http://en.wikipedia.org/wiki/OpenStack

You can write web applications that scale automatically on hosting
services like:
- Google App Engine: https://developers.google.com/appengine/
- OpenShift: http://openshift.redhat.com/
- Heroku: http://www.heroku.com/

In sum, python is used widely for a variety of purposes by some of the
largest enterprises down to very small projects.

Michael

On Sun, Jul 29, 2012 at 12:01 PM, lipska the kat lip...@yahoo.co.uk wrote:
 Pythoners

 Firstly, thanks to those on the tutor list who answered my questions.

 I'm trying to understand where Python fits into the set of commonly
 available, commercially used languages of the moment.

 My most recent experience is with Java. The last project I was involved with
 included 6775 java source files containing 1,145,785 lines of code. How do I
 know this? because I managed to cobble together a python script that walks
 the source tree and counts the lines of code. It ignores block and line
 comments and whitespace lines so I'm fairly confident it's an accurate
 total. It doesn't include web interface files (mainly .jsp and HTML) or
 configuration files (XML, properties files and what have you). In fact it
 was remarkably easy to do this in python which got me thinking about how I
 could use the language in a commercial environment.

 I was first attracted to python by it's apparent 'Object Orientedness' I
 soon realised however that by looking at it in terms of the language I know
 best I wasn't comparing like with like. Once I had 'rebooted the bioware' I
 tried to approach python with an open mind and I have to say it's growing on
 me.

 The questions I have are ...

 How is python used in the real world.
 What sized projects are people involved with
 Are applications generally written entirely in python or is it more often
 used for a subset of functionality.

 I hope this is an acceptable question for this group

 Many thanks

 Lipska

 --
 Lipska the Kat: Troll hunter, sandbox destroyer
 and farscape dreamer of Aeryn Sun
 --
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


How To AutoLogin to Website And Navigate thereafter

2012-07-29 Thread coldfire
Can Some one help me or guide me the coding for automatic login to a website 
while keeping the session alive and navigating further into website for screen 
scraping using python.

I understand the scraping part but unable to Understand the Login part using 
any of the Lib

Urllib,Urlib2,BeautifulSoup,Mechanize,Re,requests,cookiejar etc


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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Mark Lawrence

On 29/07/2012 17:01, lipska the kat wrote:

Pythoners

Firstly, thanks to those on the tutor list who answered my questions.

I'm trying to understand where Python fits into the set of commonly
available, commercially used languages of the moment.

My most recent experience is with Java. The last project I was involved
with included 6775 java source files containing 1,145,785 lines of code.
How do I know this? because I managed to cobble together a python script
that walks the source tree and counts the lines of code. It ignores
block and line comments and whitespace lines so I'm fairly confident
it's an accurate total. It doesn't include web interface files (mainly
.jsp and HTML) or configuration files (XML, properties files and what
have you). In fact it was remarkably easy to do this in python which got
me thinking about how I could use the language in a commercial environment.

I was first attracted to python by it's apparent 'Object Orientedness' I
soon realised however that by looking at it in terms of the language I
know best I wasn't comparing like with like. Once I had 'rebooted the
bioware' I tried to approach python with an open mind and I have to say
it's growing on me.

The questions I have are ...

How is python used in the real world.
What sized projects are people involved with
Are applications generally written entirely in python or is it more
often used for a subset of functionality.

I hope this is an acceptable question for this group


You are hard pushed to find anything here that's unacceptable, that's 
why I like reading this list so much.




Many thanks

Lipska



There's a list of companies who use python on www.python.org top right 
of the page.  You may have heard of one or two of them.


--
Cheers.

Mark Lawrence.

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


counting source lines (was: Is Python a commercial proposition ?)

2012-07-29 Thread Stefan Behnel
lipska the kat, 29.07.2012 18:01:
 My most recent experience is with Java. The last project I was involved
 with included 6775 java source files containing 1,145,785 lines of code.
 How do I know this? because I managed to cobble together a python script
 that walks the source tree and counts the lines of code. It ignores block
 and line comments and whitespace lines so I'm fairly confident it's an
 accurate total. It doesn't include web interface files (mainly ..jsp and
 HTML) or configuration files (XML, properties files and what have you). In
 fact it was remarkably easy to do this in python

Just a comment on this part. An even easier way to count source lines is by
using the tool SLOCCount. It also works with various languages.

Stefan


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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Brandon Schaffer
Another common use is to create automated regression testing
frameworks, and other automation tools.
I see posting for python developers for this type of thing all the
time on stack overflow careers.

On Sun, Jul 29, 2012 at 11:43 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 29/07/2012 17:01, lipska the kat wrote:

 Pythoners

 Firstly, thanks to those on the tutor list who answered my questions.

 I'm trying to understand where Python fits into the set of commonly
 available, commercially used languages of the moment.

 My most recent experience is with Java. The last project I was involved
 with included 6775 java source files containing 1,145,785 lines of code.
 How do I know this? because I managed to cobble together a python script
 that walks the source tree and counts the lines of code. It ignores
 block and line comments and whitespace lines so I'm fairly confident
 it's an accurate total. It doesn't include web interface files (mainly
 .jsp and HTML) or configuration files (XML, properties files and what
 have you). In fact it was remarkably easy to do this in python which got
 me thinking about how I could use the language in a commercial
 environment.

 I was first attracted to python by it's apparent 'Object Orientedness' I
 soon realised however that by looking at it in terms of the language I
 know best I wasn't comparing like with like. Once I had 'rebooted the
 bioware' I tried to approach python with an open mind and I have to say
 it's growing on me.

 The questions I have are ...

 How is python used in the real world.
 What sized projects are people involved with
 Are applications generally written entirely in python or is it more
 often used for a subset of functionality.

 I hope this is an acceptable question for this group


 You are hard pushed to find anything here that's unacceptable, that's why I
 like reading this list so much.


 Many thanks

 Lipska


 There's a list of companies who use python on www.python.org top right of
 the page.  You may have heard of one or two of them.

 --
 Cheers.

 Mark Lawrence.

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


Re: OT: Text editors (was Re: Search and replace text in XML file?)

2012-07-29 Thread Andrew Cooper
On 28/07/2012 16:51, Chris Angelico wrote:
 On Sat, Jul 28, 2012 at 6:29 PM, Mark Lawrence breamore...@yahoo.co.uk 
 wrote:
 I highly recommend the use of notepad++.  If anyone knows of a better text
 editor for Windows please let me know :)
 
 My current preference is SciTE, available on Linux and Windows both.
 It's configured using Lua, has lexers (and thus syntax highlighters
 and auto-indenters) for a huge list of languages (including Python, or
 I wouldn't mention it), and isn't RAM-hungry. It's not bug-free (but
 what isn't), and has a few limitations (eg it only really supports
 UTF-8), but I've found it excellent as both text editor and
 pseudo-IDE.
 
 ChrisA
 

I use emacs, which is also available for windows
(http://ftp.gnu.org/gnu/emacs/windows/ et al)

As my work requires mixing between windows, various *NIXes, GUIs and
terminals, having a common text editor across all is fantastically useful.

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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Tim Chase
On 07/29/12 12:13, Michael Hrivnak wrote:
 - Operating system installer: http://fedoraproject.org/wiki/Anaconda
 - Software repository management: http://pulpproject.org/
 - Software package installation:
 http://en.wikipedia.org/wiki/Ubuntu_Software_Center
 - Cloud computing: http://en.wikipedia.org/wiki/OpenStack

I'll include both the Bazaar and Mercurial DVCS tools which are
mostly Python (I understand some inner loops drop to C, but both
have the option to fall back to a pure Python implementation).

-tkc




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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Andrew Cooper
On 29/07/2012 17:01, lipska the kat wrote:
 Pythoners
 
 Firstly, thanks to those on the tutor list who answered my questions.
 
 I'm trying to understand where Python fits into the set of commonly
 available, commercially used languages of the moment.
 
 My most recent experience is with Java. The last project I was involved
 with included 6775 java source files containing 1,145,785 lines of code.
 How do I know this? because I managed to cobble together a python script
 that walks the source tree and counts the lines of code. It ignores
 block and line comments and whitespace lines so I'm fairly confident
 it's an accurate total. It doesn't include web interface files (mainly
 .jsp and HTML) or configuration files (XML, properties files and what
 have you). In fact it was remarkably easy to do this in python which got
 me thinking about how I could use the language in a commercial environment.
 
 I was first attracted to python by it's apparent 'Object Orientedness' I
 soon realised however that by looking at it in terms of the language I
 know best I wasn't comparing like with like. Once I had 'rebooted the
 bioware' I tried to approach python with an open mind and I have to say
 it's growing on me.
 
 The questions I have are ...
 
 How is python used in the real world.
 What sized projects are people involved with
 Are applications generally written entirely in python or is it more
 often used for a subset of functionality.

Python is used extensively in XenServer, although arguably more of a
glue between components.  The installer is entirely python, whereas the
running product uses it more for scripts and toolstack plugins.

Behind the scenes, our regression test framework is entirely python,
which performs several thousand machine hours of tests a night, from
simple tests such as verify the installer runs correctly and verify
settings are preserved across upgrade from an older version to set up
a pool of 4 servers, kill the master server (by removing its power), and
verify that the remaining 3 fail over and one gets promoted to master

~Andrew

 
 I hope this is an acceptable question for this group
 
 Many thanks
 
 Lipska
 

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


concurrent.futures vs gevent

2012-07-29 Thread subin
Hi,
It will be my first post here.
I just found a great presentation here
https://ep2012.europython.eu/conference/talks/concurrentfutures-is-here.

As non native english, i can't fully understand all of the material
presented there.
I have some doubt, i hope someone here can give clarification.

Could concurrent.futures be a (partly) replacement of gevent?
I guess not, because gevent provide lightweight thread via greenlet,
while concurrent.futures only provide multiprocessing across different
processor) (not lightweight).

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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Stefan Behnel
Tim Chase, 29.07.2012 20:28:
 On 07/29/12 12:13, Michael Hrivnak wrote:
 - Operating system installer: http://fedoraproject.org/wiki/Anaconda
 - Software repository management: http://pulpproject.org/
 - Software package installation:
 http://en.wikipedia.org/wiki/Ubuntu_Software_Center
 - Cloud computing: http://en.wikipedia.org/wiki/OpenStack
 
 I'll include both the Bazaar and Mercurial DVCS tools which are
 mostly Python (I understand some inner loops drop to C, but both
 have the option to fall back to a pure Python implementation).

I find it perfectly reasonable to use C code (and other kinds of low-level
code) in Python tools and applications. In fact, easy interfacing with
low-level code is one of (C)Python's major selling points.

Stefan


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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Terry Reedy

On 7/29/2012 12:01 PM, lipska the kat wrote:

I'm trying to understand where Python fits into the set of commonly
available, commercially used languages of the moment.


Ever heard of a little startup called Google? It was built with C, Java, 
... and Python. I believe Youtube is scripted in Python.


 Are applications generally written entirely in python
 or is it more often used for a subset of functionality.

Even if the direct application is in Python, if it runs on CPython, it 
probably uses modules coded or re-coded in C, and it certainly used 
builtin functions and classes coded in C.


The first 'killer app' for Python, in the 1990s, was its use as a glue 
language for interactive and batch scientific/numerical computation 
mostly done in compiled Fortran.


--
Terry Jan Reedy



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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Bernd Waterkamp
Michael Hrivnak schrieb:

 Python is used frequently on the server side of web applications for
 sites of all sizes, with the UI generally being done in javascript.

Two large companies with lots of python code are dropbox and youtube:

http://highscalability.com/blog/2011/3/14/6-lessons-from-dropbox-one-million-files-saved-every-15-minu.html
http://highscalability.com/blog/2012/3/26/7-years-of-youtube-scalability-lessons-in-30-minutes.html

 It's also used heavily for administrative purposes such as:
 
 - Operating system installer: http://fedoraproject.org/wiki/Anaconda
 - Software repository management: http://pulpproject.org/
 - Software package installation:
 http://en.wikipedia.org/wiki/Ubuntu_Software_Center
 - Cloud computing: http://en.wikipedia.org/wiki/OpenStack

- Frameworks/tools like func, fabric or ipython are used in medium and
large networks/clouds. 
- Python is also used a lot for admin tasks instead of shell scripts. 
- I know IBM WebSphere is not the favorite choice as an application server
for most Java programmers *g*, but it uses Jython for the admin CLI. 

python and python based tools are used for engineering and scientific
computing - some random examples: numpy, Sage, matplotlib, NetworkX. 

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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Aled Evans
On Sunday, July 29, 2012 5:01:00 PM UTC+1, lipska the kat wrote:
 Pythoners
 
 
 
 Firstly, thanks to those on the tutor list who answered my questions.
 
 
 
 I'm trying to understand where Python fits into the set of commonly 
 
 available, commercially used languages of the moment.
 
 
 
 My most recent experience is with Java. The last project I was involved 
 
 with included 6775 java source files containing 1,145,785 lines of code. 
 
 How do I know this? because I managed to cobble together a python script 
 
 that walks the source tree and counts the lines of code. It ignores 
 
 block and line comments and whitespace lines so I'm fairly confident 
 
 it's an accurate total. It doesn't include web interface files (mainly 
 
 .jsp and HTML) or configuration files (XML, properties files and what 
 
 have you). In fact it was remarkably easy to do this in python which got 
 
 me thinking about how I could use the language in a commercial environment.
 
 
 
 I was first attracted to python by it's apparent 'Object Orientedness' I 
 
 soon realised however that by looking at it in terms of the language I 
 
 know best I wasn't comparing like with like. Once I had 'rebooted the 
 
 bioware' I tried to approach python with an open mind and I have to say 
 
 it's growing on me.
 
 
 
 The questions I have are ...
 
 
 
 How is python used in the real world.
 
 What sized projects are people involved with
 
 Are applications generally written entirely in python or is it more 
 
 often used for a subset of functionality.
 
 
 
 I hope this is an acceptable question for this group
 
 
 
 Many thanks
 
 
 
 Lipska
 
 
 
 -- 
 
 Lipska the Kat: Troll hunter, sandbox destroyer
 
 and farscape dreamer of Aeryn Sun

If you check Google's job listings:

http://www.google.com/about/jobs/teams/engineering/

On the software side of things you'll see very few listings that don't ask for 
coding in Python as a requirement or, at the very least, an advantageous skill 
to have.

I'd say slowly, but surely, many people are coming around the fact that Python 
is not only as powerful as Java and other high-level languages, but it's also 
easier to read and write. That, and people (that I've spoken to, at least), 
find it far more fun to code in Python!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-29 Thread Paul van der Linden
Scripting is one of the strong sides of python. I use it al the time to quickly 
write a script to analyze something or automate. That is probably the reason it 
is used to glue (script) things together and is embedded in some programs (like 
Maya and such).

At the company we're using python and django for websites, from small micro 
sites till big enterprise sites.

Currently I'm working on a highly configurable application to control a maya 
render cluster.

You can also use it for testing and even frontend testing.

I think you can use python for almost everything, tough I think it's less 
suitable for non-web gui applications.

lipska the kat lip...@yahoo.co.ukschreef:

Pythoners

Firstly, thanks to those on the tutor list who answered my questions.

I'm trying to understand where Python fits into the set of commonly 
available, commercially used languages of the moment.

My most recent experience is with Java. The last project I was involved 
with included 6775 java source files containing 1,145,785 lines of code. 
How do I know this? because I managed to cobble together a python script 
that walks the source tree and counts the lines of code. It ignores 
block and line comments and whitespace lines so I'm fairly confident 
it's an accurate total. It doesn't include web interface files (mainly 
.jsp and HTML) or configuration files (XML, properties files and what 
have you). In fact it was remarkably easy to do this in python which got 
me thinking about how I could use the language in a commercial environment.

I was first attracted to python by it's apparent 'Object Orientedness' I 
soon realised however that by looking at it in terms of the language I 
know best I wasn't comparing like with like. Once I had 'rebooted the 
bioware' I tried to approach python with an open mind and I have to say 
it's growing on me.

The questions I have are ...

How is python used in the real world.
What sized projects are people involved with
Are applications generally written entirely in python or is it more 
often used for a subset of functionality.

I hope this is an acceptable question for this group

Many thanks

Lipska

-- 
Lipska the Kat: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
-- 
http://mail.python.org/mailman/listinfo/python-list

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


Re: OT: Text editors

2012-07-29 Thread Grant Edwards
On 2012-07-29, Mark Lawrence breamore...@yahoo.co.uk wrote:

 Point taken, snag being I've never used any nix box in anger.  This 
 thread reminds of the good 'ole days when I were a lad using TPU on
 VMS.  Have we got any VMS aficionados here?

It's been a long time, but I used eve/tpu as my main editor for
several years back when I did embedded SW development on VMS.  I was
an ex-Unix user, so I used DECShell a lot -- even though it was
painfully slow.  The entire Unix philosophy is based on the assumption
that process creation is inexpensive, and I was told process creation
on VMS was _very_ expensive, so Bourne shell scripts that would have
taken second under Unix took minutes under VMS.

-- 
Grant

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


ANN: pathlib 0.7

2012-07-29 Thread Antoine Pitrou

Hello,

pathlib 0.7 has been released with the following changes:

- Add '**' (recursive) patterns to Path.glob().
- Fix openat() support after the API refactoring in Python 3.3 beta1.
- Add a *target_is_directory* argument to Path.symlink_to()

pathlib offers a set of classes to handle filesystem paths.  It offers the
following advantages over using string objects:

* No more cumbersome use of os and os.path functions.  Everything can be
  done easily through operators, attribute accesses, and method calls.

* Embodies the semantics of different path types.  For example, comparing
  Windows paths ignores casing.

* Well-defined semantics, eliminating any warts or ambiguities (forward vs.
  backward slashes, etc.).

PyPI download page at http://pypi.python.org/pypi/pathlib/
Documentation at http://pathlib.readthedocs.org/en/latest/
Code and issue tracker at https://bitbucket.org/pitrou/pathlib/

Regards

Antoine Pitrou.


-- 
Software development and contracting: http://pro.pitrou.net


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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Thomas 'PointedEars' Lahn
Michael Hrivnak wrote:

 Python is used frequently on the server side of web applications for
 sites of all sizes, with the UI generally being done in javascript.

There is no javascript.

-- 
PointedEars

Please do not Cc: me. / Bitte keine Kopien per E-Mail.
-- 
http://mail.python.org/mailman/listinfo/python-list


simplified Python parsing question

2012-07-29 Thread Eric S. Johansson
as some folks may remember, I have been working on making Python and its tool 
base more accessible to disabled programmers. I've finally come up with a really 
simple technique which should solve 80% of the problem. What I need to figure 
out is how to find a spot in the code where a symbol exists and potentially, 
it's rough type (class name, instance, etc.). This is really a much bigger 
question that I want to get into right now but I'm looking just to build a demo 
to back up a storyboard plus video.


When you are sitting on or in a name, you look to the left or look to the right 
what would you see that would tell you that you have gone past the end of that 
name. For example


a = b + c

if you are sitting on a, the boundaries are beginning of line and =, if you are 
sitting on b, the boundaries are = and +, if you are sitting on c, the 
boundaries are + and end of line.  a call the region between those boundaries 
the symbol region.


if this example is clear to you, what you suggest for a method of finding a 
whole statement, or a whole symbol region? note, doesn't have to be perfect or 
complete solution, just good enough to let me do a moderately complex demo and 
seek funding accessibility world to build a complete environment.


I appreciate the help because I believe that once this is working, it'll make a 
significant difference in the ability for disabled programmers to write code 
again as well as be able to integrate within existing development team and their 
naming conventions.


Looking forward to responses.

--- eric

first draft write up of technique
https://docs.google.com/document/d/1In11apApKozw_UOPAhVz0ePqns72_6652Dra34xWp4E/edit
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-29 Thread Rodrick Brown
Sent from my iPhone

On Jul 29, 2012, at 12:07 PM, lipska the kat lip...@yahoo.co.uk wrote:

 Pythoners

 Firstly, thanks to those on the tutor list who answered my questions.

 I'm trying to understand where Python fits into the set of commonly 
 available, commercially used languages of the moment.

Python is a glue language much like Perl was 10 years ago. Until the
GIL is fixed I doubt anyone will seriously look at Python as an option
for large enterprise standalone application development.

I work in financials and the majority of our apps are developed in C++
and Java yet all the tools that startup, deploy and conduct rigorous
unit testing are implemented in Python or Shell scripts that wrap
Python scripts.

Python definitely has its place in the enterprise however not so much
for serious stand alone app development.

I'm starting to see Python used along side many statistical and
analytical tools like R, SPlus, and Mathlab for back testing and
prototype work, in a lot of cases I've seen quants and traders
implement models in Python to back test and if successful converted to
Java or C++.
-- 
http://mail.python.org/mailman/listinfo/python-list


Extracting bit fields from an IEEE-784 float

2012-07-29 Thread Steven D'Aprano
I wish to extract the bit fields from a Python float, call it x. First I 
cast the float to 8-bytes:

s = struct.pack('=d', x)
i = struct.unpack('=q', s)[0]

Then I extract the bit fields from the int, e.g. to grab the sign bit:

(i  0x8000)  63


Questions:

1) Are there any known implementations or platforms where Python floats 
are not C doubles? If so, what are they?

2) If the platform byte-order is reversed, do I need to take any special 
action? I don't think I do, because even though the float is reversed, so 
will be the bit mask. Is this correct?

3) Any other problems with the way I am doing this?



Thanks in advance,



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


Re: Is Python a commercial proposition ?

2012-07-29 Thread Andrew Berg
On 7/29/2012 7:12 PM, Rodrick Brown wrote:
 Python is a glue language much like Perl was 10 years ago. Until the
 GIL is fixed I doubt anyone will seriously look at Python as an option
 for large enterprise standalone application development.
The GIL is neither a bug to be fixed nor an inherent part of the
language. It is a design choice for CPython. There are reasons the
CPython devs have no intention of removing the GIL (at least in the near
future). A recent outline of these reasons (written by one of the
CPython devs) is here:

http://python-notes.boredomandlaziness.org/en/latest/python3/questions_and_answers.html#but-but-surely-fixing-the-gil-is-more-important-than-fixing-unicode
-- 
CPython 3.3.0b1 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list


PyPI question, or, maybe I'm just stupid

2012-07-29 Thread Chris Gonnerman
I've been making some minor updates to the PollyReports module I 
announced a while back, and I've noticed that when I upload it to PyPI, 
my changelog (CHANGES.txt) doesn't appear to be integrated into the site 
at all.  Do I have to put the changes into the README, or have I missed 
something here?  It seems that there should be some automatic method 
whereby PyPI users could easily see what I've changed without 
downloading it first.

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


Re: Extracting bit fields from an IEEE-784 float

2012-07-29 Thread Dan Sommers
On 2012-07-30 at 00:44:04 +,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:

 I wish to extract the bit fields from a Python float, call it x. First I 
 cast the float to 8-bytes:
 
 s = struct.pack('=d', x)
 i = struct.unpack('=q', s)[0]
 
 Then I extract the bit fields from the int, e.g. to grab the sign bit:
 
 (i  0x8000)  63

 3) Any other problems with the way I am doing this?

No, but perhaps this would be clearer:

import math
sign = math.copysign(1.0, x)

There are solutions that use math.frexp, too, but IMO they're more
obtuse.

HTH,
Dan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-29 Thread Dan Stromberg
On Sun, Jul 29, 2012 at 5:52 PM, Andrew Berg bahamutzero8...@gmail.comwrote:

 On 7/29/2012 7:12 PM, Rodrick Brown wrote:
  Python is a glue language much like Perl was 10 years ago. Until the
  GIL is fixed I doubt anyone will seriously look at Python as an option
  for large enterprise standalone application development.
 The GIL is neither a bug to be fixed nor an inherent part of the
 language. It is a design choice for CPython. There are reasons the
 CPython devs have no intention of removing the GIL (at least in the near
 future). A recent outline of these reasons (written by one of the
 CPython devs) is here:


 http://python-notes.boredomandlaziness.org/en/latest/python3/questions_and_answers.html#but-but-surely-fixing-the-gil-is-more-important-than-fixing-unicode


It's a nice document, though it seems to use the phrase shared  memory in
a novel (to me) way, and literally says that multiprocessing doesn't use
shared memory even though it does (at least in the sense of the phrase
that I'm accustomed to).

I suppose you could call what I usually refer to as shared memory,
instead System V shared memory.  It's hidden from the user to a large
extent, but when multiprocessing passes objects from one process to
another, I believe it's doing so via System V shared memory.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-29 Thread Rodrick Brown
On Jul 29, 2012, at 8:54 PM, Andrew Berg bahamutzero8...@gmail.com wrote:

 On 7/29/2012 7:12 PM, Rodrick Brown wrote:
 Python is a glue language much like Perl was 10 years ago. Until the
 GIL is fixed I doubt anyone will seriously look at Python as an option
 for large enterprise standalone application development.
 The GIL is neither a bug to be fixed nor an inherent part of the
 language. It is a design choice for CPython. There are reasons the
 CPython devs have no intention of removing the GIL (at least in the near
 future). A recent outline of these reasons (written by one of the
 CPython devs) is here:

 http://python-notes.boredomandlaziness.org/en/latest/python3/questions_and_answers.html#but-but-surely-fixing-the-gil-is-more-important-than-fixing-unicode

Hence the reason why no one will seriously look at Python for none
glue work or simple web apps.  When it comes to designing complex
applications that need to exploit large multicore systems Python just
isn't an option.

Its still not possible to be a pure Python developer and find gainful
employment today.

 --
 CPython 3.3.0b1 | Windows NT 6.1.7601.17803
 --
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-29 Thread Paul Rubin
Rodrick Brown rodrick.br...@gmail.com writes:
 Hence the reason why no one will seriously look at Python for none
 glue work or simple web apps.  When it comes to designing complex
 applications that need to exploit large multicore systems Python just
 isn't an option.

That's wrong, I've run multicore apps in Python, by just using separate
processes.  There was no GIL issue, just separate processes for each
core.  The cpython interpreter is so slow that the GIL is usually not
the bottleneck anyway.  For lots of applications this just doesn't
matter since the app is either not cpu-intensive or (in my case) all the
work is done in native libraries.

 Its still not possible to be a pure Python developer and find gainful
 employment today.

Certainly any serious programmer should be good in multiple languages,
and in fact I got to write a little bit of C code at work a few months
ago, but it wasn't really needed.  The program is all Python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simplified Python parsing question

2012-07-29 Thread Steven D'Aprano
On Sun, 29 Jul 2012 19:21:49 -0400, Eric S. Johansson wrote:

 When you are sitting on or in a name, you look to the left or look to
 the right what would you see that would tell you that you have gone past
 the end of that name. For example

Have you read the docs? It gives full details of the Python syntax.

http://docs.python.org/reference/index.html

For example:

http://docs.python.org/reference/simple_stmts.html#assignment-statements

See also:

http://docs.python.org/library/language.html
http://effbot.org/zone/simple-top-down-parsing.htm
http://nedbatchelder.com/text/python-parsers.html


Here's a Python parser using the pyparsing library. It's a bit old 
(written for Python 2.4) but it shouldn't be hard to update it to new 
syntax:

http://pyparsing.wikispaces.com/file/view/pythonGrammarParser.py



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


Re: PyPI question, or, maybe I'm just stupid

2012-07-29 Thread Ben Finney
Chris Gonnerman ch...@gonnerman.org writes:

 I've been making some minor updates to the PollyReports module

Your post is showing up as a reply to a thread about IEEE-784 floats,
because you created your message as a reply. Consequently, it's rather
confusing why you suddenly start talking about PollyReports.

If you want to attract attention to an unrelated topic, it's best if you
don't reply to an existing thread; instead, start a new thread by
composing a new message to the forum.

-- 
 \“I'd take the awe of understanding over the awe of ignorance |
  `\  any day.” —Douglas Adams |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting bit fields from an IEEE-784 float

2012-07-29 Thread Terry Reedy

On 7/29/2012 8:44 PM, Steven D'Aprano wrote:

I wish to extract the bit fields from a Python float, call it x. First I
cast the float to 8-bytes:

s = struct.pack('=d', x)
i = struct.unpack('=q', s)[0]

Then I extract the bit fields from the int, e.g. to grab the sign bit:

(i  0x8000)  63


Questions:

1) Are there any known implementations or platforms where Python floats
are not C doubles? If so, what are they?


CPython floats are C doubles, which should be IEEE doubles. Other 
implementations have a different to probably the same thing.



2) If the platform byte-order is reversed, do I need to take any special
action? I don't think I do, because even though the float is reversed, so
will be the bit mask. Is this correct?


The math modules functions to disassemble floats will not care.

--
Terry Jan Reedy



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


ANN: visage (interfaces)

2012-07-29 Thread jwp
Hi,

I just pushed this up to pypi/github, and I hoped to acquire some c.l.py 
opinions.
It's experimental at this point, and might get scrapped.

visage is a loosely coupled interface registry. weakrefs make it cake to 
implement.

Basically, zope.interface, but where the interfaces are referenced by an 
identifier instead of the defining Interface class. Also, ABC registration is 
performed when the Interface becomes available so that isinstance/issubclass 
checks can be performed on Implementation instances/classes.

FWICT, pyprotocols allows for something like this, but while introducing many 
interesting concepts. (;

Currently, visage has no concept of adaption, but I'm suspecting that it could 
be built *on top* of the existing foundation.

Personally, I'd prefer to reference interfaces by an identifier. Notably, the 
idea of having to pull in a dependency in order to perform local tests that 
have no need for the formal Interface class is reason enough for me to use 
something like this instead of the existing solutions. Sure, to each their own.?

What's c.l.py's perspective on managing interfaces and implementations?

Fuck it, ship it? =)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: visage (interfaces)

2012-07-29 Thread jwp
On Sunday, July 29, 2012 10:18:23 PM UTC-7, jwp wrote:
 I just pushed this up to pypi/github, and I hoped to acquire some c.l.py 
 opinions.

http://github.com/jwp/py-visage
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2012-07-29 Thread Georg Brandl

Georg Brandl added the comment:

Richard, can the issue be closed?

--
priority: release blocker - critical

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



[issue15295] Import machinery documentation

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

General comment:

runpy, pkgutil, et al should all get See Also links at the top pointing to 
the new import system section.

Import system intro:

As noted above, I suggest changing the name :)

Opening section should refer to importlib.import_module(). Any mentions of 
__import__ should point out that its API is designed for the convenience of the 
interpreter, and thus it's a pain to use directly. However, we should also 
document explicitly that, unlike the import statement and calling __import__ 
directly, importlib.import_module will ignore any module level replacements of 
__import__.

Replacing builtins.__import__ won't reliably override the entire import system 
(due to module level __import__ definitions, most notably importlib.__import__) 
and other tools that work with the process global import state directly (e.g. 
pkgutil, runpy).

5.1 Packages:

Don't tease readers, just tell them: the defining characteristic of a package 
is that it is a module object with a __path__ attribute.

Since we have the privilege of defining *the* standard terminology for 
old-style packages, I suggest we use the term initialised packages (since 
having an __init__.py is what makes them special). We should also note 
explicitly that an initialised package can also behave as a namespace package, 
by setting __path__ appropriately in __init__.py

Also, I suggest adding a 5.1.3 Package Example subheading - currently you 
define an initialised package under the namespace package heading

Finally, I think this section needs to explicitly define the terms *import 
path* and *path entry*. The meta path docs later refer to find_module() 
accepting a module name and path, and the reader could be forgiven for thinking 
that meant a filesystem path, when it is actually an import path (which is a 
sequence of path entries, which may themselves by filesystem paths).

5.2.2 Finders and loaders:

The term sys path finder is incorrect as registered path hooks are invoked 
for both sys.path entries *and* package __path__ entries. I suggest path entry 
finder. (I agree a longer name is needed to better distinguish them from 
metapath finders)

5.2.3 Import hooks:

While it does get cleared up in 5.2.4, this section could be clearer that the 
hooks *cannot* override the initial check of the module cache.

5.3.4 Metapath:

See above comment about clarifying that an import path is passed to 
find_module() rather than a filesystem path.

The description of the path importer is incorrect. It only knows how to scan an 
import path and interrogate the path hooks. It's the individual path entry 
finders that know how to do things like load modules from the filesystem or zip 
files.


5.2.5 Meta path loaders

I don't like the title here. There's no such thing as a meta path loader. there 
are only module loaders. Once they're created, it doesn't matter how you found 
them.

Clarify that the loader only has to remove the modules it inserted itself. 
Other modules that were loaded *successfully* as a side effect of the code 
execution will remain in the cache.

5.3 The Path Importer

As noted above, the path importer is *NOT* restricted to filesystem imports. 
All it cares about is arbitrary text sequences and path hooks. With the right 
path hook, you could use URLs or database connection strings as path entries.

5.5 References

I'd also point to PEP 328 (absolute imports by default and explicit relative 
import syntax) and PEP 338 (using the import system to find __main__)

--

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



[issue15295] Import machinery documentation

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Great start here Barry, I'll switch my checkout over to read/write access and 
start contributing fixes.

--

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



[issue15295] Import machinery documentation

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Pushed the import machinery - import system change (which hopefully won't 
break Barry's world)

Also merged in a more recent version of trunk. This probably screwed up the 
default branch in this clone, but the clone should be done after these docs 
updates.

--

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



[issue15467] Updating __sizeof__ tests

2012-07-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Patches updated. Simplified struct __sizeof__ testing for 2.7 and 3.2 and fixed 
(using 'n' for Py_ssize_t) for 3.3.

--
nosy: +meador.inge
Added file: http://bugs.python.org/file26561/sizeof_tests-3.3_2.patch

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



[issue15467] Updating __sizeof__ tests

2012-07-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Added file: http://bugs.python.org/file26562/sizeof_tests-3.2_2.patch

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



[issue15467] Updating __sizeof__ tests

2012-07-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Added file: http://bugs.python.org/file26563/sizeof_tests-2.7_2.patch

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



[issue15467] Updating __sizeof__ tests

2012-07-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Removed file: http://bugs.python.org/file26541/sizeof_tests-3.3.patch

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



[issue15467] Updating __sizeof__ tests

2012-07-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Removed file: http://bugs.python.org/file26542/sizeof_tests-3.2.patch

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



[issue15467] Updating __sizeof__ tests

2012-07-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Removed file: http://bugs.python.org/file26543/sizeof_tests-2.7.patch

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



[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

I've switched back to being -1 on the PYTHONRUNFIRST idea. There are no ACLs 
for environment variables, so the security implications scare me too much for 
me to support the feature.

The simple -C option doesn't have that problem, though, and could be used as 
infrastructure in a process infrastructure framework to provide enhanced 
configuration of Python subprocesses.

--

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
nosy: +ncoghlan

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Added patch with test cases for the situations Amaury picked up, as well 
another I noticed (when the from clause refers to a module that fails)

--
Added file: http://bugs.python.org/file26564/issue15425_test_cases.diff

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

I actually did start refactoring a lot of this when I was working on the 
pkgutil changes, but stopped because that patch was already hairy enough.

Maybe I should have kept going...

--

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

I think tuning the what frames to hide heuristic is a better bet - I remember 
know that the real reason I stopped messing with which exceptions were thrown 
was that I ended up confusing pkgutil.

--

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Fixed test case patch - previous one included a comment from when my test was 
buggy.

--
Added file: http://bugs.python.org/file26565/issue15425_test_cases.diff

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: http://bugs.python.org/file26564/issue15425_test_cases.diff

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I like the concept of exit points that Antoine introduced with a special 
method name. Maybe we coule generalize this and have a 
execute_and_hide_frames(func, *args, **kwargs) that is recognized by the 
caller in import.c.

--

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



[issue12834] memorview.to_bytes() and PyBuffer_ToContiguous() incorrect for non-contiguous arrays

2012-07-29 Thread Stefan Krah

Stefan Krah added the comment:

Christian's posts and my initial report were about memoryview.tobytes(). It's
good that you changed the title: memoryview.tobytes() is more meaningful than
the slightly obscure PyBuffer_ToContiguous().


BTW, I'm sure that PyBuffer_FromContiguous() and PyObject_CopyData() have the
same problem, but they aren't used in the Python source tree and they are
undocumented.

--

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



[issue15477] test_cmath failures on OS X 10.8

2012-07-29 Thread Mark Dickinson

Mark Dickinson added the comment:

 These types of run-time tests based on configure-time tests are problematic
 for binary installations of Python, like the OS X installers.

Understood.  I'm wondering how to fix this for Python, given that we're 
unlikely to see an OS-level fix for a while.  There's an easy workaround, 
namely to add an if (x == 0.0) return x; before any use of the system log1p;  
the issue is how and when to apply this workaround.

One option is always to apply the workaround, but this feels to me as though 
it's unnecessarily penalising those OSs that get it right;  maybe just always 
apply the workaround on OS X?

--

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

OK, to investigate the failures a bit further, I turned off the traceback 
suppression altogether by sticking an immediate return at the start of 
remove_importlib_frames. For the three failing tests, this is what I got when 
adding a traceback.print_tb call:

test_broken_from (test.test_import.ImportTracebackTests) ...   File 
/home/ncoghlan/devel/py3k/Lib/test/test_import.py, line 890, in 
test_broken_from
from _parent_foo import bar
  File frozen importlib._bootstrap, line 1572, in _handle_fromlist
  File frozen importlib._bootstrap, line 1524, in _find_and_load
  File frozen importlib._bootstrap, line 1491, in _find_and_load_unlocked
  File frozen importlib._bootstrap, line 571, in _check_name_wrapper
  File frozen importlib._bootstrap, line 1002, in load_module
  File frozen importlib._bootstrap, line 983, in load_module
  File frozen importlib._bootstrap, line 547, in module_for_loader_wrapper
  File frozen importlib._bootstrap, line 853, in _load_module
  File frozen importlib._bootstrap, line 860, in _exec_module
  File ./_parent_foo/bar.py, line 1, in module
1/0
FAIL
test_broken_parent (test.test_import.ImportTracebackTests) ...   File 
/home/ncoghlan/devel/py3k/Lib/test/test_import.py, line 902, in 
test_broken_parent
import _parent_foo.bar
  File frozen importlib._bootstrap, line 1524, in _find_and_load
  File frozen importlib._bootstrap, line 1475, in _find_and_load_unlocked
  File frozen importlib._bootstrap, line 1524, in _find_and_load
  File frozen importlib._bootstrap, line 1491, in _find_and_load_unlocked
  File frozen importlib._bootstrap, line 571, in _check_name_wrapper
  File frozen importlib._bootstrap, line 1002, in load_module
  File frozen importlib._bootstrap, line 983, in load_module
  File frozen importlib._bootstrap, line 547, in module_for_loader_wrapper
  File frozen importlib._bootstrap, line 853, in _load_module
  File frozen importlib._bootstrap, line 860, in _exec_module
  File ./_parent_foo/__init__.py, line 1, in module
1/0
FAIL
test_syntax_error (test.test_import.ImportTracebackTests) ...   File 
/home/ncoghlan/devel/py3k/Lib/test/test_import.py, line 851, in 
test_syntax_error
import foo
  File frozen importlib._bootstrap, line 1524, in _find_and_load
  File frozen importlib._bootstrap, line 1491, in _find_and_load_unlocked
  File frozen importlib._bootstrap, line 571, in _check_name_wrapper
  File frozen importlib._bootstrap, line 1002, in load_module
  File frozen importlib._bootstrap, line 983, in load_module
  File frozen importlib._bootstrap, line 547, in module_for_loader_wrapper
  File frozen importlib._bootstrap, line 838, in _load_module
  File frozen importlib._bootstrap, line 960, in get_code
FAIL

And here's what I get with my patched version enabled (which also ignores 
chunks ending with get_code when the failure is a syntax error):

test_broken_from (test.test_import.ImportTracebackTests) ...   File 
/home/ncoghlan/devel/py3k/Lib/test/test_import.py, line 890, in 
test_broken_from
from _parent_foo import bar
  File frozen importlib._bootstrap, line 1572, in _handle_fromlist
  File ./_parent_foo/bar.py, line 1, in module
1/0
FAIL
test_broken_parent (test.test_import.ImportTracebackTests) ...   File 
/home/ncoghlan/devel/py3k/Lib/test/test_import.py, line 902, in 
test_broken_parent
import _parent_foo.bar
  File frozen importlib._bootstrap, line 1524, in _find_and_load
  File frozen importlib._bootstrap, line 1475, in _find_and_load_unlocked
  File ./_parent_foo/__init__.py, line 1, in module
1/0
FAIL
test_syntax_error (test.test_import.ImportTracebackTests) ...   File 
/home/ncoghlan/devel/py3k/Lib/test/test_import.py, line 851, in 
test_syntax_error
import foo
FAIL

--

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

I realised that it is my test that was wrong in the syntax error case. Attached 
patch includes the test cases, and the fix for that case.

The weird thing that still requires an explanation is why the chunks in the 
first two cases are only being partially stripped. Those blocks end with 
_exec_module, yet a couple of frames are being left in the traceback.

Current patch includes my debugging output from those tests.

--
Added file: http://bugs.python.org/file26566/issue15425_handle_syntax_error.diff

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



[issue15268] curses configure checks fail if only /usr/include/ncursesw/curses.h is installed

2012-07-29 Thread Roumen Petrov

Roumen Petrov added the comment:

Matthias, do not use hack if cross-build

--
nosy: +rpetrov
Added file: 
http://bugs.python.org/file26567/4-CROSS-avoid-ncursesw-include-path-hack.patch

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



[issue15483] CROSS: initialise include and library paths in setup.py

2012-07-29 Thread Roumen Petrov

New submission from Roumen Petrov:

In setup.py  inc_dirs and lib_dirs are not initialized in cross-build case.

--
files: 1-CROSS-initialise-include-and-library-paths.patch
keywords: patch
messages: 166733
nosy: rpetrov
priority: normal
severity: normal
status: open
title: CROSS: initialise include and library paths in setup.py
Added file: 
http://bugs.python.org/file26568/1-CROSS-initialise-include-and-library-paths.patch

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



[issue15484] CROSS: use _PYTHON_PROJECT_BASE in distutils sysconfig

2012-07-29 Thread Roumen Petrov

New submission from Roumen Petrov:

Same as sysconfig but now in distutils  _PYTHON_PROJECT_BASE has to be used in 
cross-build environment.

--
components: Build
files: 2-CROSS-use-_PYTHON_PROJECT_BASE-in-distutils-sysconfig.patch
keywords: patch
messages: 166734
nosy: rpetrov
priority: normal
severity: normal
status: open
title: CROSS: use _PYTHON_PROJECT_BASE in distutils sysconfig
versions: Python 3.3
Added file: 
http://bugs.python.org/file26569/2-CROSS-use-_PYTHON_PROJECT_BASE-in-distutils-sysconfig.patch

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Ah, it turns out the three problem children are those which accept an import_ 
callback, which is set to builtins.__import__ when accessed via the import 
statement. This means we end up making a *recursive* call to 
PyImport_ImportModuleLevelObject, which calls remove_importlib_frames. The 
inner section of the trace gets stripped away, thus the _exec_module frame is 
already gone by the time the outer frames get added to the traceback.

For the moment, I'm just going to adopt the blunt instrument approach and 
special case those three functions (including them in the always strip 
category). If anyone else comes up with a more elegant mechanism to deal with 
the recursion, we can switch to it later.

--

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



[issue15484] CROSS: use _PYTHON_PROJECT_BASE in distutils sysconfig

2012-07-29 Thread Roumen Petrov

Roumen Petrov added the comment:

Also _PYTHON_PROJECT_BASE should be initialized to build directory by configure 
- low priority as other issue prevent python to be build and tested smoothly 
outside source tree.

--
Added file: 
http://bugs.python.org/file26570/2-CROSS-set-_PYTHON_PROJECT_BASE-to-current-build-dir.patch

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



[issue15485] CROSS: append gcc library search paths

2012-07-29 Thread Roumen Petrov

New submission from Roumen Petrov:

Currently if cross-build add_gcc_paths use append_dir_to_list but later prepend 
library paths. As result  gcc is multilib 64-bit libraries will be found first 
before 32-bit one.

--
components: Cross-Build
files: 3-CROSS-append-gcc-library-search-paths.patch
keywords: patch
messages: 166737
nosy: rpetrov
priority: normal
severity: normal
status: open
title: CROSS: append gcc library search paths
versions: Python 3.3
Added file: 
http://bugs.python.org/file26571/3-CROSS-append-gcc-library-search-paths.patch

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



[issue15482] __import__() change between 3.2 and 3.3

2012-07-29 Thread Martin v . Löwis

Martin v. Löwis added the comment:

So should 3.2 be changed to adjust the default value to match the documentation?

--
nosy: +loewis

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



[issue12834] memoryview.to_bytes() and PyBuffer_ToContiguous() incorrect for non-contiguous arrays

2012-07-29 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
title: memorview.to_bytes() and PyBuffer_ToContiguous() incorrect for 
non-contiguous arrays - memoryview.to_bytes() and PyBuffer_ToContiguous() 
incorrect for non-contiguous arrays

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



[issue15484] CROSS: use _PYTHON_PROJECT_BASE in distutils sysconfig

2012-07-29 Thread Roumen Petrov

Changes by Roumen Petrov bugtr...@roumenpetrov.info:


--
components: +Cross-Build -Build
type:  - compile error

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



[issue15483] CROSS: initialise include and library paths in setup.py

2012-07-29 Thread Roumen Petrov

Changes by Roumen Petrov bugtr...@roumenpetrov.info:


--
components: +Cross-Build
versions: +Python 3.3

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

I'll at least introduce a _recursive_import exit point to simplify handling 
of those three cases. For those, if there isn't another importlib frame on the 
stack below them, odds are pretty good that it has been stripped already.

--

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



[issue3754] cross-compilation support for python build

2012-07-29 Thread Roumen Petrov

Roumen Petrov added the comment:

I hope that  following separate issues will address remaining part of this 
patch:

required:
- 15483: initialise include and library paths in setup.py
- 15484: use _PYTHON_PROJECT_BASE in distutils sysconfig
- TODO: typo in in configure.in - use ac_cv_pthread instead ac_cv_thread
- 15268: skip curses configure checks fail if only 
/usr/include/ncursesw/curses.h is installed

optional:
- 15298: _sysconfigdata is generated in srcdir, not builddir
- 14598: _cursesmodule.c fails with ncurses-5.9 on Linux reported first as 
14438 - _cursesmodule build fails on cygwin
and all other that allow python to be build smoothly outside source directory

--
components: +Cross-Build -Build, Distutils2

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



[issue3871] cross and native build of python for mingw32 with packaging

2012-07-29 Thread Roumen Petrov

Roumen Petrov added the comment:

May be patch 20120729 cannot be applied as my source tree contain a number of 
patches related to cross build - see msg166740  from issue 3754 .

--
Added file: http://bugs.python.org/file26572/python-py3k-20120729-MINGW.patch

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

I think the implementation I just checked in is close to being as simple as we 
can get:

Blocks ending in _exec_module and _recursive_import are trimmed unconditionally
For SyntaxError, it also trims blocks ending in get_code
For ImportError, it trims everything involving importlib

Because the latter two are conditional on the kind of exception thrown, it's 
only the first two that could be unified and I think keeping the two distinct 
checks is actually clearer in that case.

--

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 75a30a478dc7 by Nick Coghlan in branch 'default':
Close #15425: Eliminate more importlib related traceback noise
http://hg.python.org/cpython/rev/75a30a478dc7

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

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

On second thought, I realised having a general purpose hide this hook means 
that any future unconditional cases can easily be hidden just by changing from 
the normal call to a stripped call. I'll implement that now.

--

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



[issue15486] Standardise the mechanisms for stripping importlib frames

2012-07-29 Thread Nick Coghlan

New submission from Nick Coghlan:

Thanks to issue #15425, the number of special cases in the importlib frame 
stripping is growing. This patch tweaks the frame stripping mechanism to make 
it easy to selectively strip frames in importlib._bootstrap by creating a 
_call_with_frames_removed helper function.

The rules in remove_importlib_frames then change to remove any sequence of 
importlib frames which ends with that helper and all importlib frames in the 
ImportError case.

--
messages: 166745
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Standardise the mechanisms for stripping importlib frames

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



[issue15425] Another strange Tracebacks with importlib

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Seeing as the blocker is dealt with for beta2, see #15486 for the proposed 
refactoring.

--

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



[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-07-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I've switched back to being -1 on the PYTHONRUNFIRST idea. There are
 no ACLs for environment variables, so the security implications scare
 me too much for me to support the feature.

I'm quite sure PYTHONHOME and PYTHONPATH already allow you to mess quite
freely. That's why we have the -E flag.

I'm -0.5 myself, though, for the reason that it complicates the startup
process a little bit more, without looking very compelling. It smells
disturbingly like LD_PRELOAD to me.

 The simple -C option doesn't have that problem, though, and could be
 used as infrastructure in a process infrastructure framework to
 provide enhanced configuration of Python subprocesses.

What do you mean exactly?

--

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



[issue15486] Standardised mechanism for stripping importlib frames from tracebacks

2012-07-29 Thread Nick Coghlan

Nick Coghlan added the comment:

In trying to find a new case that wasn't already covered by the test suite, I 
found an error which I'm not even sure should be an error. Doesn't 3.2 suppress 
failures that occur when attempting to implicitly cache the .pyc?

Anyway, given the rest of the patch, trimming this traceback will be easy if we 
decide that's the right thing to do.

--
components: +Interpreter Core, Library (Lib)
keywords: +patch
nosy: +amaury.forgeotdarc, brett.cannon, eric.snow, georg.brandl
priority: normal - release blocker
stage:  - patch review
title: Standardise the mechanisms for stripping importlib frames - 
Standardised mechanism for stripping importlib frames from tracebacks
type:  - behavior
versions: +Python 3.3
Added file: 
http://bugs.python.org/file26573/issue15486_simplify_importlib_frame_removal.diff

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



[issue15482] __import__() change between 3.2 and 3.3

2012-07-29 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



  1   2   3   >