Re: Hello World

2014-12-21 Thread Marko Rauhamaa
CM cmpyt...@gmail.com:

 On Sunday, December 21, 2014 2:44:50 AM UTC-5, CM wrote:
 Hello, world!
 13

 Actually, there is no comma after Hello. 

Do you have a patch?


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to generate a wsdl file for a web service in python

2014-12-21 Thread Burak Arslan

On 12/19/14 12:45, brice DORA wrote:
 i have already my python file which contains all methods of my web service. 
 so do you give a example or tell me how i can do it...

No, all you need is there in that example.

You need to decorate your functions using Spyne's @rpc, denote
input/output types using Spyne's type markers, wrap it inside a subclass
of Spyne's ServiceBase, pass the resulting service class to a Spyne
application setting your input/output protocols (you probably want Soap)
and pass that application to a transport of your choice (you probably
want WsgiApplication). If you need a Wsgi server, use CherryPy.

Bon courage,
Burak

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


Re: very weird pandas behavior

2014-12-21 Thread ryguy7272
On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:
 I downloaded pandas and put it in my python directory, then, at the C-prompt, 
 I ran this:
 pip install pandas
 
 It looks like everything downloaded and installed fine.  Great.
 
 Now, in Python Shell, I enter this:
 import pandas as pd
 
 I get this error.  
 Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
 ImportError: No module named pandas
 
 
 Any idea what I'm doing wrong?


Thanks Steven.  I just tried what you recommended, and got this.

 import sys
 print(sys.version)
2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)]
 print(sys.path)
['C:\\Python27\\Lib\\idlelib', 
'C:\\Python27\\lib\\site-packages\\requests-2.4.3-py2.7.egg', 
'C:\\Python27\\lib\\site-packages\\html-1.16-py2.7.egg', 'C:\\Python34', 
'C:\\WINDOWS\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs', 
'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 
'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']
 


I also got this.

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Ryanpython
Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win
32
Type help, copyright, credits or license for more information.
 python27
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'python27' is not defined
 python33
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'python33' is not defined
 python34
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'python34' is not defined


Any idea what's wrong?  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: very weird pandas behavior

2014-12-21 Thread Dave Angel

On 12/21/2014 07:44 AM, ryguy7272 wrote:

On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:

I downloaded pandas and put it in my python directory, then, at the C-prompt, I 
ran this:
pip install pandas


Thanks Steven.  I just tried what you recommended, and got this.


import sys
print(sys.version)

2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)]

print(sys.path)

['C:\\Python27\\Lib\\idlelib', 
'C:\\Python27\\lib\\site-packages\\requests-2.4.3-py2.7.egg', 
'C:\\Python27\\lib\\site-packages\\html-1.16-py2.7.egg', 'C:\\Python34', 
'C:\\WINDOWS\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs', 
'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 
'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']





I also got this.

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Ryanpython
Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win
32
Type help, copyright, credits or license for more information.

python27

Traceback (most recent call last):
   File stdin, line 1, in module
NameError: name 'python27' is not defined


python27 and python33 are Windows commands, not Python ones.  You run 
them at the cmd prompt.  Steven suggested those to see what other 
versions of Python you have installed.


And of course the other question is what directory did pandas get 
installed to.   You can find that out with the find command, except that 
you're on Windows.  So I think you'd have to use  dir /s




--
DaveA
--
https://mail.python.org/mailman/listinfo/python-list


Re: Hello World

2014-12-21 Thread Marko Rauhamaa
Tony the Tiger tony@tiger.invalid:

 On Sat, 20 Dec 2014 23:57:08 +1100, Steven D'Aprano wrote:

 I am in total awe.

 I'm not. It has no real value.

It is, of course, a joke, and there are whole tongue-in-cheek languages
like Brainfuck. However, some similar exercises carry deep meaning.
Take, for example, iota and jot (URL:
http://semarch.linguistics.fas.nyu.edu/barker/Iota/).

 Write your code like that and you'll soon be looking for a new job.

Navigare necesse est, vivere non est necesse.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


problems with Methods in Python 3.4.2

2014-12-21 Thread Marcus Lütolf
Hello Dears,

I solved the problem: There are two underscore key strokes required.
Marcus.

Hello Dears,

1)I am trying to do this:



 dir(_builtins_)



I am getting this:

Traceback (most recent call last):

  File pyshell#0, line 1, in module

dir(_builtins_)

NameError: name '_builtins_' is not defined



2)I am trying to do this:



 'TTA',_add_('GGA')



I’am getting this :

Traceback (most recent call last):

  File pyshell#0, line 1, in module

'TTA',_add_('GGA')

NameError: name '_add_' is not defined



3)I am trying to do this:



 -3  .abs()



I’am getting this

Traceback (most recent call last):

  File pyshell#1, line 1, in module

-3 .abs()

AttributeError: 'int' object has no attribute 'abs'



4) finally, after printing



abs._doc_()



I am getting this (and so on) :

Traceback (most recent call last):

  File pyshell#2, line 1, in module

abs._doc_()

AttributeError: 'builtin_function_or_method' object has no attribute '_doc_'

What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet,
CH-7000 Chur, Switzerland.





---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
http://www.avast.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple background sound effect playback

2014-12-21 Thread Akira Li
Jacob Kruger ja...@blindza.co.za writes:

 Would prefer to use something free, that could work somewhat
 cross-platform, but, my primary target is for windows OS, and would
 primarily just want to be able to easily trigger playback of either
 .wav or .mp3 background sound effects, but, yes, would also be nice to
 be able to control them a little bit in terms of volume, possibly
 stereo panning as well as playback rate/frequency/pitch?

 I have used something called sound_lib, as well as another one
 relating to a sort of windows directSound effect, but, both of them
 had issues when working with either py2exe or cx_freeze when it came
 to compiling into executable, and main thing is would like to keep it
 simple...smile

 Suggestions?


You could try GStreamer: it is free, cross-platform, it allows you to
play media files in the background, to control volume, stereo panning
(e.g., GstAudioPanorama), to change the playback rate while preserving
pitch, it can use DirectShow on Windows, etc -- see
http://gstreamer.freedesktop.org/features/

The downside is that it may be complex to install and use e.g., it
probably works with py2exe but it won't be simple to configure.

If you know other library that provides similar feature list while being
less complex; do tell.


--
Akira.

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


Re: Simple background sound effect playback

2014-12-21 Thread Jacob Kruger
Will have a look at it as well, but, also already tested generating a 
console/command line app using the pygame code to play an .ogg file, panning 
it left and right, and the compilation worked alright, and am now still busy 
reloading primary machine, so haven't taken it too much further, but let's 
see...


Am not sure of redistribution licence either, and will need/want to test it 
on a couple of other types of machines.


Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
Roger Wilco wants to welcome you...to the space janitor's closet...

- Original Message - 
From: Akira Li 4kir4...@gmail.com

To: python-list@python.org
Sent: Monday, December 22, 2014 12:11 AM
Subject: Re: Simple background sound effect playback



Jacob Kruger ja...@blindza.co.za writes:


Would prefer to use something free, that could work somewhat
cross-platform, but, my primary target is for windows OS, and would
primarily just want to be able to easily trigger playback of either
.wav or .mp3 background sound effects, but, yes, would also be nice to
be able to control them a little bit in terms of volume, possibly
stereo panning as well as playback rate/frequency/pitch?

I have used something called sound_lib, as well as another one
relating to a sort of windows directSound effect, but, both of them
had issues when working with either py2exe or cx_freeze when it came
to compiling into executable, and main thing is would like to keep it
simple...smile

Suggestions?



You could try GStreamer: it is free, cross-platform, it allows you to
play media files in the background, to control volume, stereo panning
(e.g., GstAudioPanorama), to change the playback rate while preserving
pitch, it can use DirectShow on Windows, etc -- see
http://gstreamer.freedesktop.org/features/

The downside is that it may be complex to install and use e.g., it
probably works with py2exe but it won't be simple to configure.

If you know other library that provides similar feature list while being
less complex; do tell.


--
Akira.

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



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


Re: Hello World

2014-12-21 Thread Steven D'Aprano
Tony the Tiger wrote:

 On Sat, 20 Dec 2014 23:57:08 +1100, Steven D'Aprano wrote:
 
 I am in total awe.
 
 I'm not. It has no real value. Write your code like that and you'll soon
 be looking for a new job.

Awww, did da widdle puddy tat get up on the wrong side of the bed this
morning? :-)


Obviously you don't write obfuscated code like this for production use,
except in such cases where you deliberately want to write obfuscated code
for production use.

Any beginner with 3 seconds experience with Python can write:

print Hello World


But being able to write obfuscated code to that degree displays real skill
and understanding of the language, and a great deal of patience and stick
with it-ness, all of which are valuable work skills.



-- 
Steven

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


Re: Hello World

2014-12-21 Thread Roy Smith
In article 54974ed7$0$12986$c3e8da3$54964...@news.astraweb.com,
 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:

 Obviously you don't write obfuscated code like this for production use,
 except in such cases where you deliberately want to write obfuscated code
 for production use.

Heh.  I once worked on a C++ project that included its own crypo code 
(i.e. custom implementations of things like AES and SHA-1).  The person 
who wrote some particular bit of the code had decided that deliberately 
obfuscating the function and variable names would somehow make it more 
secure, so that's what he did.

The mind boggles.  At so many levels.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello World

2014-12-21 Thread Chris Angelico
On Mon, Dec 22, 2014 at 10:50 AM, Roy Smith r...@panix.com wrote:
 Heh.  I once worked on a C++ project that included its own crypo code
 (i.e. custom implementations of things like AES and SHA-1).  The person
 who wrote some particular bit of the code had decided that deliberately
 obfuscating the function and variable names would somehow make it more
 secure, so that's what he did.

 The mind boggles.  At so many levels.

Level 0: Why implement your own crypto?!?

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


Re: Hello World

2014-12-21 Thread Roy Smith
In article mailman.17098.1419207020.18130.python-l...@python.org,
 Chris Angelico ros...@gmail.com wrote:

 On Mon, Dec 22, 2014 at 10:50 AM, Roy Smith r...@panix.com wrote:
  Heh.  I once worked on a C++ project that included its own crypo code
  (i.e. custom implementations of things like AES and SHA-1).  The person
  who wrote some particular bit of the code had decided that deliberately
  obfuscating the function and variable names would somehow make it more
  secure, so that's what he did.
 
  The mind boggles.  At so many levels.
 
 Level 0: Why implement your own crypto?!?
 
 ChrisA

That would be one of the levels.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello World

2014-12-21 Thread mm0fmf

On 22/12/2014 00:10, Chris Angelico wrote:

Level 0: Why implement your own crypto?!?


Because people who don't understand the concepts behind cryptography 
don't understand that the crypto algorithm can be open whilst the 
results of applying the algorithm are secure.


There again I always use ROT-13 to encrypt my stuff. For the stuff that 
really has to be NSA-proof I use ROT-13 twice.


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


Re: Hello World

2014-12-21 Thread Chris Angelico
On Mon, Dec 22, 2014 at 11:12 AM, Roy Smith r...@panix.com wrote:
 In article mailman.17098.1419207020.18130.python-l...@python.org,
  Chris Angelico ros...@gmail.com wrote:

 On Mon, Dec 22, 2014 at 10:50 AM, Roy Smith r...@panix.com wrote:
  Heh.  I once worked on a C++ project that included its own crypo code
  (i.e. custom implementations of things like AES and SHA-1).  The person
  who wrote some particular bit of the code had decided that deliberately
  obfuscating the function and variable names would somehow make it more
  secure, so that's what he did.
 
  The mind boggles.  At so many levels.

 Level 0: Why implement your own crypto?!?

 ChrisA

 That would be one of the levels.

Good, I'm glad you agree on that one. I don't mind reimplementing some
other protocols (couple years ago now I built my own OAuth library
because the provided one was being terrible - no, this wasn't in
Python), especially the simple ones (SMTP or FTP - use a
library/module if available, but otherwise just establish a socket
connection and do whatever you need), and even complex protocols can
occasionally be worth reworking (Pike has its own PostgreSQL client,
rather than using libpq, and it gets some handy improvements in
concurrency), but crypto's one thing that it's *never* worth
rewriting.

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


Re: Hello World

2014-12-21 Thread Tim Chase
On 2014-12-22 00:20, mm0fmf wrote:
 On 22/12/2014 00:10, Chris Angelico wrote:
  Level 0: Why implement your own crypto?!?
 
 Because people who don't understand the concepts behind
 cryptography don't understand that the crypto algorithm can be open
 whilst the results of applying the algorithm are secure.
 
 There again I always use ROT-13 to encrypt my stuff. For the stuff
 that really has to be NSA-proof I use ROT-13 twice.

Pshaw. When I really want to be secure, I stick to *Triple ROT13*

I mean, why else would Vim have the ability to do it easily out of
the box? (I suspect Emacs offers similar functionality)

Like ed(1), it's a standard! ;-)

-tkc




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


Re: very weird pandas behavior

2014-12-21 Thread ryguy7272
On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:
 I downloaded pandas and put it in my python directory, then, at the C-prompt, 
 I ran this:
 pip install pandas
 
 It looks like everything downloaded and installed fine.  Great.
 
 Now, in Python Shell, I enter this:
 import pandas as pd
 
 I get this error.  
 Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
 ImportError: No module named pandas
 
 
 Any idea what I'm doing wrong?



Sorry for being so dense here guys!!  I do tons and tons of work with VBA, VB, 
C#, SQL, R, Matlab, and a little work with Pascal.  I guess that's preventing 
me from understanding how Python works.  Sorry, but I just don't understand 
this thing.  I uninstalled Python27 and just reinstalled it.  I open the cmd 
prompt, and entered two short commands: 'pip install numpy'  'pip install 
pandas'.  Then, I got to Python Shell and enter this: 'import numpy'  'import 
pandas'.  immediately I get errors.  

Traceback (most recent call last):
  File pyshell#2, line 1, in module
import numpy
ImportError: No module named numpy

Traceback (most recent call last):
  File pyshell#3, line 1, in module
import pandas
ImportError: No module named pandas

I guess if I can't do something simple, I can't do anything complex...or 
anything at all.

Part of the problem is, I don't know why in 2014 we're entering commands in the 
C-prompt to run a Windows program.  I thought all of that stuff was over in the 
very early 1990s.  Also, I can't understand why Python can't download this from 
the Internet.  

If someone can help me figure this out, I'd be most appreciative.  I don't want 
to give up, but after spending over 6 months learning Python, and reading 15 
Python books cover to cover, I don't understand why a simple 'import pandas' 
can't even work!!  That's about as basic as it gets.

Ugh.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: very weird pandas behavior

2014-12-21 Thread Chris Angelico
On Mon, Dec 22, 2014 at 12:01 PM, ryguy7272 ryanshu...@gmail.com wrote:
 Part of the problem is, I don't know why in 2014 we're entering commands in 
 the C-prompt to run a Windows program.  I thought all of that stuff was over 
 in the very early 1990s.  Also, I can't understand why Python can't download 
 this from the Internet.


You're expecting a GUI to let you pick stuff to install? That probably
exists... as a wrapper around the terminal commands. The command line
has never died, and never will. (I dream of futuristic voice-activated
spaceship computers that respond to Computer! Console. by revealing
a keyboard and screen with a login prompt.)

Python can download this from the internet; in fact, that's exactly
what the pip install numpy command does. However, you have to be
explicit. You don't want the simple import numpy command to go and
install some third-party software; that would mean that mistyping it
as import numpt would also attempt to install something new, and
immediately run it. That's dangerous, costly (network requests can
take a long time), and definitely not a good idea.

What happened when you ran the 'pip install' lines? Also, what is the
output of 'pip --version' and 'python --version'?

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


Re: very weird pandas behavior

2014-12-21 Thread oldknackers
On Saturday, December 20, 2014 3:46:40 PM UTC, ryguy7272 wrote:
 I downloaded pandas and put it in my python directory, then, at the C-prompt, 
 I ran this:
 pip install pandas
 
 It looks like everything downloaded and installed fine.  Great.
 
 Now, in Python Shell, I enter this:
 import pandas as pd
 
 I get this error.  
 Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
 ImportError: No module named pandas
 
 
 Any idea what I'm doing wrong?

It's begining to look like weird behavour from ryguy7272, multipe times asking 
how to install numpy on python-forum.org and not following the advice given.
http://www.python-forum.org/viewtopic.php?f=10t=13700p=23970#p23970
http://www.python-forum.org/viewtopic.php?f=6t=13748p=24082#p24082
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: very weird pandas behavior

2014-12-21 Thread Dave Angel

On 12/21/2014 08:01 PM, ryguy7272 wrote:

On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:

I downloaded pandas and put it in my python directory, then, at the C-prompt, I 
ran this:
pip install pandas

It looks like everything downloaded and installed fine.  Great.

Now, in Python Shell, I enter this:
import pandas as pd

I get this error.
Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
ImportError: No module named pandas


Any idea what I'm doing wrong?




Sorry for being so dense here guys!!  I do tons and tons of work with VBA, VB, 
C#, SQL, R, Matlab, and a little work with Pascal.
 I guess that's preventing me from understanding how Python works. 
Sorry, but I just don't understand this thing.


Have you tried reading and responding to the advice you get?  Or do you 
just pick and choose?



 I uninstalled Python27 and just reinstalled it.


What did you do with the other Python versions that you still haven't 
said whether you have?



 I open the cmd prompt, and entered two short commands: 'pip install numpy'  
'pip install pandas'.


And they got command not found errors, right?  After all, you haven't 
installed PIP yet.  Or if you have, it might be left over from some 
other version of Python.


Have you read anything about PIP?  Have you read the web page:
   https://pypi.python.org/pypi/pip/

Perhaps you could try:
pip show --files numpy

and see where they got installed.  Are they the same place as the Python 
2.7 you just installed?




 Then, I got to Python Shell and enter this: 'import numpy'  'import pandas'.  
immediately I get errors.

Traceback (most recent call last):
   File pyshell#2, line 1, in module
 import numpy
ImportError: No module named numpy

Traceback (most recent call last):
   File pyshell#3, line 1, in module
 import pandas
ImportError: No module named pandas

I guess if I can't do something simple, I can't do anything complex...or 
anything at all.



If I had any confidence that you were always running the same version of 
Python, from the same installation, then I could suggest more stuff, 
like checking out sys.path and comparing it to the place where PIP 
installed things.


--
DaveA
--
https://mail.python.org/mailman/listinfo/python-list


Re: very weird pandas behavior

2014-12-21 Thread ryguy7272
On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:
 I downloaded pandas and put it in my python directory, then, at the C-prompt, 
 I ran this:
 pip install pandas
 
 It looks like everything downloaded and installed fine.  Great.
 
 Now, in Python Shell, I enter this:
 import pandas as pd
 
 I get this error.  
 Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
 ImportError: No module named pandas
 
 
 Any idea what I'm doing wrong?



Thanks for being patient with me everyone.


I just tried this:
C:\Users\Ryanpip --version
pip 1.5.6 from C:\Python27\lib (python 2.7)

C:\Users\Ryanpython --version
Python 2.7


I just tried 'pip show --files numpy' in the command prompt; nothing happened.


I'll read that link now.


I know my eyes are not very good...my vision is quite poor...but I'm trying to 
read this stuff, and I'm trying to figure out what's going on here...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: very weird pandas behavior

2014-12-21 Thread ryguy7272
On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:
 I downloaded pandas and put it in my python directory, then, at the C-prompt, 
 I ran this:
 pip install pandas
 
 It looks like everything downloaded and installed fine.  Great.
 
 Now, in Python Shell, I enter this:
 import pandas as pd
 
 I get this error.  
 Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
 ImportError: No module named pandas
 
 
 Any idea what I'm doing wrong?



Ok, if I enter this into the command prompt:

'pip show --files numpy'
'pip show --files pandas'

I get nothing returned from either entry.  That seems ot be a problem!

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


Re: very weird pandas behavior

2014-12-21 Thread ryguy7272
On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:
 I downloaded pandas and put it in my python directory, then, at the C-prompt, 
 I ran this:
 pip install pandas
 
 It looks like everything downloaded and installed fine.  Great.
 
 Now, in Python Shell, I enter this:
 import pandas as pd
 
 I get this error.  
 Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
 ImportError: No module named pandas
 
 
 Any idea what I'm doing wrong?



I just ran these two commands in the c-prompt:
pip install --upgrade numpy
pip install --upgrade pandas

It seemed like everything was being downloaded and installed.  Seems ok.  Then 
I go back to the Python Shell and ran 'import numpy'  'import pandas' and I 
still get the errors that I got before.

So, I move on to this:
pip uninstall numpy
pip uninstall pandas

It says, cannon uninstall, non installed.

Sorry, but that's what drives me nuts.  I install a few packages, and the 
messages that I get says the package is installed...then it says it's NOT 
installed...I don't know what to think...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello World

2014-12-21 Thread Cameron Simpson

On 21Dec2014 01:31, Terry Reedy tjre...@udel.edu wrote:

On 12/21/2014 12:31 AM, Chris Angelico wrote:

On Sun, Dec 21, 2014 at 4:14 PM, CM cmpyt...@gmail.com wrote:

I ran it in IDLE with Python 2.7.8 and got:

Traceback (most recent call last):
  File C:/Python27/helloworld.py, line 39, in module
lambda _, __, ___, , _, __, ___, : _
  File C:/Python27/helloworld.py, line 21, in lambda
_))) + (_  __) + (_  ___)
OSError: [Errno 9] Bad file descriptor


Yes, because - like most Hello world programs - it attempts to write
to stdout. This interferes with IDLE and the way it captures output
for the graphical environment.


Just to be clear, writing to sys.stdout works fine in Idle.

import sys; sys.stdout.write('hello ')

hello  #2.7

In 3.4, the number of chars? bytes? is returned and written also.

Whether you mean something different by 'stdout' or not, I am not 
sure.


He means file descriptor 1. sys.stdout does not have a file descriptor at all 
under IDLE.



The error is from writing to a non-existent file descriptor.
The os 'file descriptor functions are unix functions.  Many but not 
all also work on Windows.  I do not believe that was true on msdos. 
According to the os doc, they do not work on osx.


Please cite that doc. OSX _is_ UNIX, like almost all modern platforms.
A glance at a set of 3.4.0 docs convenient to hand finds only one call 
explicitly labelled as not working under MacOS (os.fdatasync).



Python io streams are not required to have a file descriptor.


Indeed, but the program cited relies on one. So it is not perfectly portable, 
but still widely usable.


Cheers,
Cameron Simpson c...@zip.com.au

Tachyon: A gluon that's not completely dry.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Hello World

2014-12-21 Thread Rustom Mody
On Monday, December 22, 2014 4:21:13 AM UTC+5:30, Steven D'Aprano wrote:
 
 Awww, did da widdle puddy tat get up on the wrong side of the bed this
 morning? :-)
 
 
 Obviously you don't write obfuscated code like this for production use,
 except in such cases where you deliberately want to write obfuscated code
 for production use.
 
 Any beginner with 3 seconds experience with Python can write:
 
 print Hello World
 

Bad Boy -- Stand in the corner for forgetting the '()'
[Good boys use python3]
On a more serious note...

 Tony the Tiger wrote:
 
  On Sat, 20 Dec 2014 23:57:08 +1100, Steven D'Aprano wrote:
  
  I am in total awe.
  
  I'm not. It has no real value. Write your code like that and you'll soon
  be looking for a new job.


If a python teacher wanted, that blog has enough internal python mechanisms on 
display strung together into a cute result
for a number of lectures. [If only I could wrap my brain round it all]

IOW learning language-L and real world programming in L are 
quite different. Related to 

1. People read programs far more often than they write
2. Different types of vocabularies
http://en.wikipedia.org/wiki/Vocabulary#Degree_of_knowledge
and next
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: very weird pandas behavior

2014-12-21 Thread Chris Angelico
On Mon, Dec 22, 2014 at 1:25 PM, ryguy7272 ryanshu...@gmail.com wrote:

 I just ran these two commands in the c-prompt:
 pip install --upgrade numpy
 pip install --upgrade pandas

 It seemed like everything was being downloaded and installed.  Seems ok.  
 Then I go back to the Python Shell and ran 'import numpy'  'import pandas' 
 and I still get the errors that I got before.

 So, I move on to this:
 pip uninstall numpy
 pip uninstall pandas

 It says, cannon uninstall, non installed.

 Sorry, but that's what drives me nuts.  I install a few packages, and the 
 messages that I get says the package is installed...then it says it's NOT 
 installed...I don't know what to think...


Lesson #0 of computing: When a program tells you something and you
then ask for help, *copy and paste* the program's output. It seemed
like is the most likely source of error here. Maybe there was an
error reported, and you simply didn't recognize it... but by not
showing us the output, you force us to trust your judgment about what
it seemed like.

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


Re: very weird pandas behavior

2014-12-21 Thread Mark Lawrence

On 22/12/2014 02:07, ryguy7272 wrote:

On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:

I downloaded pandas and put it in my python directory, then, at the C-prompt, I 
ran this:
pip install pandas

It looks like everything downloaded and installed fine.  Great.

Now, in Python Shell, I enter this:
import pandas as pd

I get this error.
Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
ImportError: No module named pandas


Any idea what I'm doing wrong?




Thanks for being patient with me everyone.


I just tried this:
C:\Users\Ryanpip --version
pip 1.5.6 from C:\Python27\lib (python 2.7)

C:\Users\Ryanpython --version
Python 2.7


I just tried 'pip show --files numpy' in the command prompt; nothing happened.


I'll read that link now.


I know my eyes are not very good...my vision is quite poor...but I'm trying to 
read this stuff, and I'm trying to figure out what's going on here...



Try 'pip --help'.

c:\cpythonpip --help

Usage:
  pip command [options]

Commands:
  install Install packages.
  uninstall   Uninstall packages.
  freeze  Output installed packages in requirements 
format.

  listList installed packages.
  showShow information about installed packages.
  search  Search PyPI for packages.
  wheel   Build wheels from your requirements.
  zip DEPRECATED. Zip individual packages.
  unzip   DEPRECATED. Unzip individual packages.
  bundle  DEPRECATED. Create pybundles.
  helpShow help for commands.

General Options:
  -h, --help  Show help.
  -v, --verbose   Give more output. Option is additive, and 
can be

  used up to 3 times.
  -V, --version   Show version and exit.
  -q, --quiet Give less output.
  --log-file path   Path to a verbose non-appending log, that 
only
  logs failures. This log is active by 
default at

  C:\Users\Mark\pip\pip.log.
  --log pathPath to a verbose appending log. This log is
  inactive by default.
  --proxy proxy Specify a proxy in the form
  [user:passwd@]proxy.server:port.
  --timeout sec Set the socket timeout (default 15 seconds).
  --exists-action actionDefault action when a path already exists:
  (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --cert path   Path to alternate CA bundle.

Having digested the above try 'pip list'.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: very weird pandas behavior

2014-12-21 Thread Rustom Mody
On Monday, December 22, 2014 7:55:50 AM UTC+5:30, ryguy7272 wrote:

 Sorry, but that's what drives me nuts.  I install a few packages, and the 
 messages that I get says the package is installed...then it says it's NOT 
 installed...I don't know what to think...

Its nice to bang the head against the wall (at times)
The wall can feel so cool (at times)

Its also nice to listen

 On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote:
  I downloaded pandas and put it in my python directory, then, at the 
  C-prompt, I ran this:
  pip install pandas
  
  It looks like everything downloaded and installed fine.  Great.
  
  Now, in Python Shell, I enter this:
  import pandas as pd
  
  I get this error.  
  Traceback (most recent call last):
File pyshell#19, line 1, in module
  import pandas as pd
  ImportError: No module named pandas
  
  
  Any idea what I'm doing wrong?
 
 
 
 I just ran these two commands in the c-prompt:
 pip install --upgrade numpy
 pip install --upgrade pandas
 
 It seemed like everything was being downloaded and installed.

To whom did it 'seem'?
Best I can see you've been suggested to paste the result of these
commands and you insist on thrashing about and not paying attention.

On a different note:

 Part of the problem is, I don't know why in 2014 we're 
 entering commands in the C-prompt to run a Windows program.  I 
 thought all of that stuff was over in the very early 1990s.  
 Also, I can't understand why Python can't download this from 
 the Internet.

is called culture-clash.
Like going from one side of the Atlantic to the other and complaining
Why the ^)%% is everyone driving on the wrong side of the road?

We use the command line a bit out here.
Perhaps less than bash-programmers
More then VB programmers.

You are free to
1. Get used to the different culture
2. Stay in familiar territory
3. Thrash about
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello World

2014-12-21 Thread Mark Lawrence

On 22/12/2014 00:20, mm0fmf wrote:

On 22/12/2014 00:10, Chris Angelico wrote:

Level 0: Why implement your own crypto?!?


Because people who don't understand the concepts behind cryptography
don't understand that the crypto algorithm can be open whilst the
results of applying the algorithm are secure.

There again I always use ROT-13 to encrypt my stuff. For the stuff that
really has to be NSA-proof I use ROT-13 twice.



That is the sort of cunning plan that is even more cunning than the very 
best of Baldrick's cunning plans :)


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Why my ; continuator idea is better for debugging too.

2014-12-21 Thread Skybuck Flying

Hello,

In the past I wrote about pascal's ; mistake.

; should be used as a continuator.

I just made a programming mistake which solidifies/merits my idea:

The programming mistake was this:

vBattlefieldLosingWarrior :=

// modified warrior and brain
vSimulatorWinningWarrior := vBattlefieldBattle.Warrior[0];

Code should look like this:

vBattlefieldLosingWarrior := 
TBattlefieldWarrior(vBattlefieldBattle.Warrior[2].Association);


// modified warrior and brain
vSimulatorWinningWarrior := vBattlefieldBattle.Warrior[0];

Fortunately there was a type mistmatch which hinted me at the programming 
mistake.


The code is a bit messy above so let's make a simpler example to understand, 
the in my oppinion, dangerous programming mistake:


A :=

B := C;

The above statements A := is valid in Delphi's current design.

The danger is that B is assigned to A which is not what I wanted, the 
problem was missing code at A.


So the danger is that some day, somebody will write B in such a way that it 
will accidently be assigned to A.


By using ; as a continuator instead of a seperator the code would look 
as follows:


A :=

B := C

Since there was no continuator specified, future-Delphi would have been 
able to detect this programming mistake.


Since it won't try to attach B to A since there is no continuator symbol.

I found it worth it to mention this so there ya go.

I am always glad when Delphi finds bugs like these... fortunately this time 
I got lucky thanks to a type mismatch.


Also the statement would have looked like A:=B:=C; which I think is not a 
valid statement in Delphi.


I ll test that just to be sure.

Yes fortunately Delphi does not allow such dangerous statements.

However I think C does, I am pretty sure of it. Another nice example why C 
is dangerous ! ;)


(Also my request for python is the : symbol removed from language and 
instead require statements to be on next line below if statement that be 
nice)
(Currently the : is perceived by me as unnecessary and annoying, an easy 
typo to make just like forgetting a ; however these are not necessary in 
python so why remove ; but not : ? seems inconsistent, and ya know me... 
I don't like inconsistencies, it's frikking annoying.).


Bye,
 Skybuck.

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


Re: Why my ; continuator idea is better for debugging too.

2014-12-21 Thread Steven D'Aprano
On Mon, 22 Dec 2014 04:28:33 +0100, Skybuck Flying wrote:

 I don't like inconsistencies, it's frikking annoying.).

I don't like cross-posting trolls, they're frikking annoying.


 Bye,

Oh, if only that were true.



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


Re: Why my ; continuator idea is better for debugging too.

2014-12-21 Thread Chris Angelico
On Mon, Dec 22, 2014 at 2:53 PM, Steven D'Aprano st...@pearwood.info wrote:
 On Mon, 22 Dec 2014 04:28:33 +0100, Skybuck Flying wrote:

 I don't like inconsistencies, it's frikking annoying.).

 I don't like cross-posting trolls, they're frikking annoying.

My first thought was that it had been sent to the wrong list. That's
something I've been guilty of at times.

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


Re: code python

2014-12-21 Thread Rustom Mody
On Saturday, December 20, 2014 7:30:20 AM UTC+5:30, Khetam Yassen wrote:
 Hello all
 I Have problem about , How i can compute accuracy to unigram,bigram and 
 trigram
 and how i can change the size to iteration separate from 1 to 10 in each 
 stage from iteration train take 90% and training 10%.
 thank you to read my message

Assuming this is about nltk, your subject line needs to say that.
Also may be better to ask on an nltk-specific list
https://groups.google.com/forum/#!forum/nltk-users
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: very weird pandas behavior

2014-12-21 Thread Steven D'Aprano
On Sun, 21 Dec 2014 18:25:38 -0800, ryguy7272 wrote:

 I just ran these two commands in the c-prompt: 
 pip install --upgrade numpy
 pip install --upgrade pandas

What is the purpose of the --upgrade switch?

Just run `pip install numpy`, and COPY and PASTE the entire output of pip 
into your reply. Please don't say it seemed like it installed, because 
your judgement may be wrong.


 It seemed like everything was being downloaded and installed.  Seems ok.
  Then I go back to the Python Shell and ran 'import numpy'  'import
 pandas' and I still get the errors that I got before.


I gave you some instructions to try before, but you don't appear to have 
followed them. Let's try again:

(1) First, confirm how many different versions of Python you have 
installed. Please don't reinstall Python again. That doesn't help, if 
anything it may make matters worse.

I suggested that you try running the following commands from the DOS 
prompt (or C-prompt, if you prefer to call it that):

python27
python33
python34

although not being an expert on Windows I'm not sure if there is a better 
way.

Another way may be to use the Windows' Find Files command to look for 
any .exe files with python in the name.


(2) Next, try installing numpy and pandas again, only this time don't use 
the --upgrade switch. COPY AND PASTE the output so we can see exactly 
what happened.


(3) Try running the Python shell again. Tell us *what* Python shell you 
are using. Your tracebacks say pyshell#19 which is not standard. What 
are you actually running? Tell us *exactly* what steps you take to run 
the Python shell.


(4) I think you are running some sort of IDE (Integrated Development 
Environment). Are you running a third-party system like Anaconda, or 
possible something like Spyder? If so, then I suggest you check whether 
that third-party system is causing the problem. From the C prompt, just 
run python and then try importing numpy and see what happens. Again, 
COPY AND PASTE any output.


(5) Consider that unless you have a C compiler, and possibly a Fortran 
compiler, you may not be able to install numpy from source on your 
system. You may need to find some pre-built packages that match your 
version of Windows.



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


List Comprehensions

2014-12-21 Thread Ganesh Pal
Hi ,


(a)  I was trying to reduce the below piece of code using List
comprehension ? Any suggestion please let me know


 for opt in options:
  opt['result'] = Queue.Queue()
  tmp_thread = pause.Thread(opt)
  threads.append(tmp_thread)
   tmp_thread.start()

(b) *   Is there anything that I need to consider while using list
comprehension with threads ?*


Regards,

Ganesh
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: List Comprehensions

2014-12-21 Thread Chris Angelico
On Mon, Dec 22, 2014 at 4:42 PM, Ganesh Pal ganesh1...@gmail.com wrote:
 (a)  I was trying to reduce the below piece of code using List comprehension
 ? Any suggestion please let me know


  for opt in options:
   opt['result'] = Queue.Queue()
   tmp_thread = pause.Thread(opt)
   threads.append(tmp_thread)
tmp_thread.start()

 (b)Is there anything that I need to consider while using list
 comprehension with threads ?

Your code is doing several things at once, so it's probably not worth
trying to turn it into a comprehension. I don't think it needs to be
shortened, anyway; looks fine to me.

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


Re: Hello World

2014-12-21 Thread Steve Hayes
On Mon, 22 Dec 2014 09:51:02 +1100, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:

Tony the Tiger wrote:

 On Sat, 20 Dec 2014 23:57:08 +1100, Steven D'Aprano wrote:
 
 I am in total awe.
 
 I'm not. It has no real value. Write your code like that and you'll soon
 be looking for a new job.

Awww, did da widdle puddy tat get up on the wrong side of the bed this
morning? :-)


Obviously you don't write obfuscated code like this for production use,
except in such cases where you deliberately want to write obfuscated code
for production use.

Yes, my initial reaction was that's awesome.

And my second thought was that it was scary.

I ran it. It worked, and printed Hello world. I was awed.

But what if I had run it and it reformatted my hard disk?

How would I have known that it would or wouldn't do that?


-- 
Steve Hayes from Tshwane, South Africa
Web:  http://www.khanya.org.za/stevesig.htm
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: very weird pandas behavior

2014-12-21 Thread oldknackers
On Saturday, December 20, 2014 3:46:40 PM UTC, ryguy7272 wrote:
 I downloaded pandas and put it in my python directory, then, at the C-prompt, 
 I ran this:
 pip install pandas
 
 It looks like everything downloaded and installed fine.  Great.
 
 Now, in Python Shell, I enter this:
 import pandas as pd
 
 I get this error.  
 Traceback (most recent call last):
   File pyshell#19, line 1, in module
 import pandas as pd
 ImportError: No module named pandas
 
 
 Any idea what I'm doing wrong?

Take a look at ryguy7272's previous questions here
https://groups.google.com/forum/#!searchin/comp.lang.python/ryguy7272
which take no notice of advice given.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello World

2014-12-21 Thread Chris Angelico
On Mon, Dec 22, 2014 at 5:21 PM, Steve Hayes hayes...@telkomsa.net wrote:
 Yes, my initial reaction was that's awesome.

 And my second thought was that it was scary.

 I ran it. It worked, and printed Hello world. I was awed.

 But what if I had run it and it reformatted my hard disk?

 How would I have known that it would or wouldn't do that?

You trust that (a) Steven D'Aprano isn't going to give you outright
malicious code (or that he trusts that the original author won't), and
that (b) your hard disk cannot be reformatted by a non-root user.
Every major platform has this kind of privilege separation (Windows
doesn't call it root but Administrator, but the effect is, AIUI,
equivalent), so unless you're running random scripts from the internet
with maximum privileges, you should be safe.

Frankly, though, it's no worse than downloading binary code from the
internet and running it. How do you know that the executable you just
downloaded really is what it claims to be, that you didn't get some
MITM shipping you a malicious binary? Yet men and women do this every
day, with none to say Oh the pity of it, save me and fools like me.

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


Re: Hello World

2014-12-21 Thread Steve Hayes
On Mon, 22 Dec 2014 17:33:10 +1100, Chris Angelico ros...@gmail.com wrote:

On Mon, Dec 22, 2014 at 5:21 PM, Steve Hayes hayes...@telkomsa.net wrote:
 Yes, my initial reaction was that's awesome.

 And my second thought was that it was scary.

 I ran it. It worked, and printed Hello world. I was awed.

 But what if I had run it and it reformatted my hard disk?

 How would I have known that it would or wouldn't do that?

You trust that (a) Steven D'Aprano isn't going to give you outright
malicious code (or that he trusts that the original author won't), and
that (b) your hard disk cannot be reformatted by a non-root user.
Every major platform has this kind of privilege separation (Windows
doesn't call it root but Administrator, but the effect is, AIUI,
equivalent), so unless you're running random scripts from the internet
with maximum privileges, you should be safe.

Well yes, (a) is what I did and why I ran it. 

But a hacker who can write that kind of stuff can probably bypass any
safeguards built into the OS. 

As others have pointed out, it's not so much coding as black magic!


-- 
Steve Hayes from Tshwane, South Africa
Web:  http://www.khanya.org.za/stevesig.htm
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello World

2014-12-21 Thread Chris Angelico
On Mon, Dec 22, 2014 at 6:46 PM, Steve Hayes hayes...@telkomsa.net wrote:
 But a hacker who can write that kind of stuff can probably bypass any
 safeguards built into the OS.

This isn't magic. You can't just do more of it to get past the
firewalls, like in sci fi. It's much MUCH easier to attack the humans
than the computers.

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


[issue23096] Implementation-depended pickling floats with protocol 0

2014-12-21 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Python and C implementations of pickle produce different results when pickle 
floats with protocol 0.

 pickle.dumps(4.2, 0)
b'F4.2002\n.'
 pickle._dumps(4.2, 0)
b'F4.2\n.'

--
components: Library (Lib)
messages: 232992
nosy: alexandre.vassalotti, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Implementation-depended pickling floats with protocol 0
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue23097] unittest can unnecessarily modify sys.path (and with the wrong case)

2014-12-21 Thread Chris Jerdonek

New submission from Chris Jerdonek:

I have observed that when running unit tests using unittest's test discovery, 
unittest can simultaneously (1) modify sys.path unnecessarily (by adding a path 
that is already in sys.path with a different case), and (2) modify sys.path by 
adding a path of the wrong case.

This occurs for me on Mac OS X with the default case-insensitive file system.

If the path--

'/Users/chris/Dev/python/my_package'

is already in sys.path, running unittest's test discovery will prepend sys.path 
with the following:

'/Users/chris/dev/python/my_package'

Aside from causing unnecessary modifications of sys.path, this also causes an 
issue in coverage, for example:

https://bitbucket.org/ned/coveragepy/issue/348

The relevant code is here in unittest/loader.py (with `top_level_dir` starting 
out as os.curdir):

top_level_dir = os.path.abspath(top_level_dir)

if not top_level_dir in sys.path:
# all test modules must be importable from the top level directory
# should we *unconditionally* put the start directory in first
# in sys.path to minimise likelihood of conflicts between installed
# modules and development versions?
sys.path.insert(0, top_level_dir)
self._top_level_dir = top_level_dir

(from 
https://hg.python.org/cpython/file/75ede5bec8db/Lib/unittest/loader.py#l259 )

The issue occurs when os.path.abspath(top_level_dir) is already in sys.path but 
with a different case.  (Note that if os.path.abspath() returned a path with 
the right case, then the unittest code would be okay.)

See also these two threads regarding obtaining the correct case for a path:

1. https://mail.python.org/pipermail/python-dev/2010-September/103823.html
2. https://mail.python.org/pipermail/python-ideas/2010-September/008153.html

--
components: Library (Lib)
messages: 232993
nosy: chris.jerdonek
priority: normal
severity: normal
status: open
title: unittest can unnecessarily modify sys.path (and with the wrong case)
type: behavior
versions: Python 3.4, Python 3.5

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



[issue23094] Unpickler failing with PicklingError at frame end on readline due to a broken comparison

2014-12-21 Thread Serhiy Storchaka

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


--
keywords: +patch
Added file: http://bugs.python.org/file37521/pickle_frame_readline.patch

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



[issue21279] str.translate documentation incomplete

2014-12-21 Thread Martin Panter

Martin Panter added the comment:

Patch v4 with John’s doc string wording

--
Added file: http://bugs.python.org/file37522/issue21279.v4.patch

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



[issue23096] Implementation-depended pickling floats with protocol 0

2014-12-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Python implementation uses repr(value) and C implementation uses '%.17g' % 
value.

--

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



[issue23094] Unpickler failing with PicklingError at frame end on readline due to a broken comparison

2014-12-21 Thread CensoredUsername

CensoredUsername added the comment:

Indeed. In my case the problem was caused a subclassed Pickler which still used 
GLOBAL instead of STACK_GLOBAL in protocol 4.

My own minimized test case was:

data = b\x80\x04\x95\x11\x00\x00\x00\x00\x00\x00\x00cpickle\nPickler\n.
 pickletools.dis(data)
0: \x80 PROTO  4
2: \x95 FRAME  17
   11: cGLOBAL 'pickle Pickler'
   27: .STOP
highest protocol among opcodes = 4

which should return pickle.Pickler

--

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



[issue23093] repr() on detached stream objects fails

2014-12-21 Thread Martin Panter

Martin Panter added the comment:

Here is patch v2, which ignores any exception derived from the Exception base 
class when reading the self.name etc properties. I’m interested what people 
think of this approach.

--
Added file: http://bugs.python.org/file37523/detach-indep.v2.patch

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



[issue23093] repr() on detached stream objects fails

2014-12-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It looks reasonable to me.

--

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



[issue21279] str.translate documentation incomplete

2014-12-21 Thread John Posner

John Posner added the comment:

Patch of 12-21 looks good, Martin.

--

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



[issue21279] str.translate documentation incomplete

2014-12-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed wording looks superfluously verbose to me.

Look also at description in Include/unicodeobject.h:

/* Translate a string by applying a character mapping table to it and
   return the resulting Unicode object.

   The mapping table must map Unicode ordinal integers to Unicode
   ordinal integers or None (causing deletion of the character).

   Mapping tables may be dictionaries or sequences. Unmapped character
   ordinals (ones which cause a LookupError) are left untouched and
   are copied as-is.

*/

It is repeated (more detailed) in Doc/c-api/unicode.rst. Isn't it pretty clear?

--
components: +Unicode
nosy: +ezio.melotti, georg.brandl, haypo, serhiy.storchaka

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



[issue22836] Broken Exception ignored in: message on exceptions in __repr__

2014-12-21 Thread R. David Murray

R. David Murray added the comment:

See also issue 6294 for a related problem.

--

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



[issue21279] str.translate documentation incomplete

2014-12-21 Thread Martin Panter

Martin Panter added the comment:

Serhiy can you point out which bits are too verbose? Perhaps you prefer it 
without the bullet list like in the earlier 2014-12-13 version of the patch.

Looking at the C API, I see a couple problems there:
* Omits mentioning that an ordinal can map to a replacement string
* It looks like the documented None behaviour applies when errors=ignore, 
otherwise it invokes a codec error handler

--

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



[issue6294] Improve shutdown exception ignored message

2014-12-21 Thread Martin Panter

Martin Panter added the comment:

Not sure what the original method to cause this message is. I’m guessing some 
code was trying to call a function that was set to None by the shutdown 
process, causing the exception message, and that repr() was also failing, 
causing the broken wording. Like this:

$ python2  PYTHON
 class C:
 def __repr__(self): return None()
 def __del__(self): None()
 x = C()
 PYTHON
Exception TypeError: 'NoneType' object is not callable in  ignored

If this is the case, then it is the same problem as Issue 22836, where I have 
posted a test and a fix for Python 3.

--
nosy: +vadmium

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



[issue23098] mknod devices can be 32 bits

2014-12-21 Thread Jesús Cea Avión

New submission from Jesús Cea Avión:

Dan MacDonald told me that os.mknod() should accept devices 32 bits.

I wrote this code in linux 64 bits:


#include sys/types.h
#include sys/stat.h
#include fcntl.h
#include unistd.h
#include stdio.h

int main(void) {
printf(%d, sizeof(dev_t));
return 0;
}


The result of running this is 8. We need a long long.

I did this change in Python 2.7 branch:


diff -r f00412d32b41 Modules/posixmodule.c
--- a/Modules/posixmodule.c Sat Dec 20 13:41:14 2014 -0600
+++ b/Modules/posixmodule.c Sun Dec 21 23:30:00 2014 +0100
@@ -7009,9 +7009,9 @@
 {
 char *filename;
 int mode = 0600;
-int device = 0;
+long long device = 0;
 int res;
-if (!PyArg_ParseTuple(args, s|ii:mknod, filename, mode, device))
+if (!PyArg_ParseTuple(args, s|iL:mknod, filename, mode, device))
 return NULL;
 Py_BEGIN_ALLOW_THREADS
 res = mknod(filename, mode, device);


Looks like this patch is trivial. Please, comment.

--
assignee: jcea
keywords: easy
messages: 233004
nosy: jcea
priority: normal
severity: normal
stage: patch review
status: open
title: mknod devices can be 32 bits
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue22836] Broken Exception ignored in: message on exceptions in __repr__

2014-12-21 Thread Martin Panter

Martin Panter added the comment:

Patch v2 revises the unit tests so they are cleaner. Also now tests that the 
repr() failed placeholders are in the exception reports.

--
Added file: http://bugs.python.org/file37524/unraisable-continue.v2.patch

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



[issue23093] repr() on detached stream objects fails

2014-12-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f3ff3e424b6f by Benjamin Peterson in branch '3.4':
allow more operations to work on detached streams (closes #23093)
https://hg.python.org/cpython/rev/f3ff3e424b6f

New changeset afa8d8ab0937 by Benjamin Peterson in branch '2.7':
allow more operations to work on detached streams (closes #23093)
https://hg.python.org/cpython/rev/afa8d8ab0937

New changeset f2cfa8a348dd by Benjamin Peterson in branch 'default':
merge 3.4 (#23093)
https://hg.python.org/cpython/rev/f2cfa8a348dd

--
nosy: +python-dev
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue19539] The 'raw_unicode_escape' codec buggy + not appropriate for Python 3.x

2014-12-21 Thread Martin Panter

Martin Panter added the comment:

[Edit Error: 'utf8' codec can't decode byte 0xe2 in position 212: invalid 
continuation byte]


Re-reading the suggested description, it struck me that for encoding, this is 
redundant with the “backslashreplace” error handler:

 test = .join(map(chr, range(sys.maxunicode + 1)))
 test.encode(raw-unicode-escape) == test.encode(latin-1, 
 backslashreplace)
True

However, decoding also seems similar to “unicode_escape”, except that only 
\u and \U seem to be supported.

Maybe there should be a warning that backslashes are not escaped:

 \\u005C.encode(raw-unicode-escape).decode(raw-unicode-escape)
'\\'

--

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



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-21 Thread Ian Lee

Ian Lee added the comment:

So one concern that was brought up on GitHub was the fact that currently this 
is not actually followed universally in the Python standard library. In 
particular there are 636 errors in the standard library ``python pep8.py 
--select E402 --statistics /usr/lib/python3.4``.

The vast majority are due to issues with dunder definitions 
``__{all,author,copyright,credits,version,etc...}__`` before the imports. A 
lesser cause is imports in the middle of files. ``Lib/tokenize.py`` has pretty 
much all of these issues. In particular ``__all__`` is specifically mentioned 
that it should be declared AFTER the imports by PEP-8. That said, I would argue 
this is a good time to clean up that code in the standard library.

Additionally, its possible that there might need to be some wording in the PEP 
about intermixing try,except,else,finally and possibly if,elif,else into 
the imports. E.g. 

```
try: 
import unittest2
except:
import unittest
```

```
if sys.platform == 'win32':
import foo
```

--

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



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-21 Thread Ezio Melotti

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


--
nosy: +ezio.melotti

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



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2014-12-21 Thread Ian Lee

Ian Lee added the comment:

I should add that I would be happy to patch the standard libraries to be 
compliant w.r.t. the imports at top of the files.

--

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



[issue21279] str.translate documentation incomplete

2014-12-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Serhiy can you point out which bits are too verbose? Perhaps you prefer it
 without the bullet list like in the earlier 2014-12-13 version of the
 patch.

I prefer it without the bullet list and without LookupError expansion (there 
is a link to LookupError definition where IndexError and KeyError should be 
mentioned). Instead of new term subscriptable objects use mappings or 
sequences with links to glossary.

 Looking at the C API, I see a couple problems there:

Yes, it is slightly outdated and needs updates.

--

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