ANN: New WinPython with Python 2.7.6 and 3.3.3 (32/64bit)

2013-12-27 Thread Pierre Raybaut
Hi all,

I am pleased to announce that four new versions of WinPython have been
released yesterday with Python 2.7.6 and 3.3.3, 32 and 64 bits. Many
packages have been added or upgraded (Spyder 2.2.5 for Python 2, Spyder
2.3.0beta2 for Python 3, SciPy 0.13.2, NumPy MKL 1.8.0, IPython 1.0, etc.
-- see the complete changelog:
https://sourceforge.net/p/winpython/wiki/ChangeLog_27/).

Special thanks to Christoph Gohlke for building most of the binary packages
bundled in WinPython.

WinPython is a free open-source portable distribution of Python
for Windows, designed for scientists: http://winpython.sourceforge.net/.

It is a full-featured Python-based scientific environment:
  * Designed for scientists (thanks to the integrated libraries
NumPy, SciPy, Matplotlib, guiqwt, etc.:
* Regular *scientific users*: interactive data processing
and visualization using Python with Spyder
* *Advanced scientific users and software developers*:
Python applications development with Spyder, version control with
Mercurial and other development tools (like gettext)
  * *Portable*: preconfigured, it should run out of the box on any machine
under Windows (without any installation requirements) and the folder
containing WinPython can be moved to any location (local, network or
removable drive)
  * *Flexible*: one can install (or should I write use as it's portable)
as many WinPython versions as necessary (like isolated and self-consistent
environments), even if those versions are running different versions of
Python (2.7, 3.x in the near future) or different architectures (32bit or
64bit) on the same machine
  * *Customizable*: using the integrated package manager (wppm,
as WinPython Package Manager), it's possible to install, uninstall
or upgrade Python packages (see
https://sourceforge.net/p/winpython/wiki/WPPM/ for more details
on supported package formats).

*WinPython is not an attempt to replace Python(x,y)*, this is
just something different: more flexible, easier to maintain, movable and
less invasive for the OS, but certainly less user-friendly, with less
packages/contents and without any integration to Windows explorer [*].

[*] Actually there is an optional integration into Windows
explorer, providing the same features as the official Python installer
regarding file associations and context menu entry (this option may be
activated through the WinPython Control Panel), and adding shortcuts to
Windows Start menu.

Enjoy!

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

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


Re: Variables in a loop, Newby question

2013-12-27 Thread vanommen . robert
Hello everyone, I have been away for a while.
I have been reading all the good advises and want to explain why I want to read 
the temperatures separately from the main script. It takes a long time to read 
out 10 temperatures. About 10 seconds. So that’s the reason why I had the idea 
to create a separate script and I thought by making te variables Global I could 
access them by other scripts. Now I know that’s not the purpose of Global.
Maybe I can create a loop that keeps running simultaneously with the rest of 
the script. 
I’ve downloaded a great student book about Python and learning a lot.
Thanks for all the answers and I’ll post more questions in the future, I’m sure 
of it.
Greetings Robert
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Google Groups + this list

2013-12-27 Thread rurpy
On 12/26/2013 05:41 AM, Chris Angelico wrote:
 On Thu, Dec 26, 2013 at 4:13 PM,  ru...@yahoo.com wrote:
 On 12/25/2013 09:17 PM, Chris Angelico wrote:
[...]
 Or maybe I should have just filtered everything from Google Groups
 into the bit bucket, because responding just creates threads like
 this. Do you honestly think that would be better? No response at all
 if the post comes from GG?

 Do you really think that if *you* ignore Google Groups, then
 Google Groups posters will get no response at all?  Could
 you please turn down your ego a little?
 
 That's not what I said, 

On rereading, my interpretation of your statement still seems 
legitimate.  If you don't clarify, then my response can only 
be: yes, that *is* (in effect) what you said.

 and you're still ignoring the primary thrust
 of my posts. 

I wasn't sure what your primary thrust was, I asked you 
to remind me and you failed to respond.

If you're referring to, 
  Why, rurpy, do you continue to support, apologize for, 
  and argue in favour of, a piece of software that is 

1. You are continuing to try to misdirect from, *my* primary 
thrust: that in your zeal to make people stop using GG you 
crossed a line by posting some derogatory claims about GG 
that you can not support. I am still waiting for a credible 
explanation from you about how you know that GG is corrupting 
whitespace.

2. I've addressed why I oppose trying to drive people away 
from GG many times, among others in:
  https://groups.google.com/d/msg/comp.lang.python/FFAe5sJ7kQ4/SXXunRofxtEJ
  https://groups.google.com/d/msg/comp.lang.python/Rxw7H4yNGh4/9txi2cB7ppMJ
  https://groups.google.com/d/msg/comp.lang.python/Rxw7H4yNGh4/WRZDOzZd76oJ
  https://groups.google.com/d/msg/comp.lang.python/Rxw7H4yNGh4/41hZ3Si5G0cJ
  https://groups.google.com/d/msg/comp.lang.python/Rxw7H4yNGh4/jKu57BLvqIUJ
  https://groups.google.com/d/msg/comp.lang.python/wh9MzFEHDMM/iwZKSMeRwjQJ
Those are some from 2012 (don't have time to find 2013 ones). 
Many are direct responses to you, most or all are in threads 
you posted in.  Please, instead of just ignoring what I wrote
and repeating the same charges ad infinitum, point out why 
the answers I've already given are wrong.

3. I answered you in a previous post in this thread referring 
you to my explanation of your issue in a concurrent reply to 
Ned B.  Unfortunately that previous post got stuck in the ether
somewhere and just popped out this morning (not your fault of 
course that it wasn't available till now).

4. Virtually all of my responses in the GG wars have been 
only in response to correct or point out some inaccurate 
(IMO) information posted by someone else (often you): that 
Usenet/mailing list/whatever is easy to use as GG, that 
the community opposes posts from GG, that the majority 
of people here don't read posts from GG, that GG is 
irredeemably broken, the alternatives have no significant
problems, that reading GG posts make you go blind, and many 
more I can't recall.  Seldom if ever have I initiated any of 
these debates and have ignored many erroneous or inflammatory 
posts that I could (and perhaps should) have responded to.   

 I'm done debating this with you; I'll continue to push
 people toward options that don't have bugs that inflict themselves on
 everyone else, 

It is the pushing I object to.  I've repeatedly said 
if you want tell people about other options you think are 
better and why, I'm all for it.  But making up negative 
stuff up about GG (or anything that you personally don't 
like) should  be totally unacceptable here, and I think it 
is a shame (and sadly illustrative of the deterioration 
of this group) that you (and some others) proudly announce 
your intent to continue.

 and if you continue apologizing for something that
 needs to be fixed, that's your business.

I'm not apologizing for GG.  I have acknowledged the problems
their FUd quoting creates.  I have in my own small way tried 
to improve things.  You seem to think though that your opinion 
of how to deal with the problem should be the law.  Again I 
ask you to check your ego. 

Finally, I remind you that the only reason I am in this thread 
is because *you* posted some negative claims about GG that you 
can't support and aren't man enough to admit to.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unicode to human readable format

2013-12-27 Thread tomasz . kaczorek
hello,
can I ask you for help? when I try to print s[0] i vane the message: 
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: 
ordinal not in range(128). 
how to solve my problem, please?


regards,
t.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: So, what's the real story on Python 2 vs Python 3?

2013-12-27 Thread Rustom Mody
On Fri, Dec 27, 2013 at 11:53 AM, Dan Stromberg wrote:
 On Thu, Dec 26, 2013 at 9:43 PM, Rustom Mody  wrote:
 2. Always write strings with a u prefix
 3.0, 3.1 and 3.2 don't understand this, but 3.3 does.

Ok
I was writing this under the assumption that 2 is really entrenched
whereas 3.n is dispensable when 3.n+1 comes out
At least on my debian box 3.2 recently got obsoleted and removed when
3.3 came out.


 In a project I wanted to run on 2.5, 2.6, 2.7, 3.0, 3.1, 3.2 and 3.3,

Obviously my assumption may not always be 'assumable' eg sometime ago
there was someone who wanted to port his old working python app to 3.
2to3 was not working because he was using string exceptions (His code
was 1.something!!)


-- 

http://blog.languager.org
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: So, what's the real story on Python 2 vs Python 3?

2013-12-27 Thread Chris Angelico
On Fri, Dec 27, 2013 at 9:51 PM, Rustom Mody rustompm...@gmail.com wrote:
 On Fri, Dec 27, 2013 at 11:53 AM, Dan Stromberg wrote:
 On Thu, Dec 26, 2013 at 9:43 PM, Rustom Mody  wrote:
 2. Always write strings with a u prefix
 3.0, 3.1 and 3.2 don't understand this, but 3.3 does.

 Ok
 I was writing this under the assumption that 2 is really entrenched
 whereas 3.n is dispensable when 3.n+1 comes out
 At least on my debian box 3.2 recently got obsoleted and removed when
 3.3 came out.

That's true except for the comes out part. Just because python.org
has released a newer 3.x Python doesn't mean everyone has it; Debian
Wheezy (the current stable) ships with 3.2, and Debian Squeeze (the
current oldstable, still supported and will be until some time 2014
probably) ships 3.1. So for scripts that need to be deployed onto one
of the most popular Linux distributions, supporting only 3.3 is pretty
much out of the question. And Red Hat, generally, is supported for
even longer. I don't know what Python versions are going to still be
around for the next ten years, but the easiest way to check would
probably be to see what RHEL support dates and Python versions are.

However, I do broadly agree. For controlled environments, you should
be able to slide from 3.1 to 3.2 to 3.3 to 3.4 on whatever schedule
you choose, and happily drop support for the older versions. But in
less controlled environments, that's a bit harder.

Probably within the next 5 years, it'll become reasonably plausible to
support nothing older than 2.6, and then all those 3.x compatibility
__future__s will be all you need. Well, most of what you need. There
are still fundamental issues with functions not taking Unicode
strings, but that's going to be a problem whatever you do. But life'll
be a lot easier.

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


Re: So, what's the real story on Python 2 vs Python 3?

2013-12-27 Thread Steven D'Aprano
Chris Angelico wrote:

 However, I do broadly agree. For controlled environments, you should
 be able to slide from 3.1 to 3.2 to 3.3 to 3.4 on whatever schedule
 you choose, and happily drop support for the older versions. But in
 less controlled environments, that's a bit harder.
 
 Probably within the next 5 years, it'll become reasonably plausible to
 support nothing older than 2.6, 

It's already reasonable to support nothing older than 2.6, or 2.7 for that
matter.

The *first* question you have to ask is, which third-party libraries do I
rely on? Those libraries will set the minimum system requirement. Beyond
that, you have total freedom to support as many or as few versions as you
like. Ask yourself:

- Which operating systems do I intend to support?

If the answer is Windows only, you pretty much can pick whichever version
of Python you like, since all versions of Python are equally difficult (or
easy) to install on Windows. Likewise for Mac.

If the answer includes Linux or Unix, then the next question to ask is:

- Shall I support only the OS-provided version(s) of Python?

If so, then you need to work out which version(s) of Python are common to
all the OSes you intend to support. E.g. there are currently supported
versions of Centos and RHEL that provide Python 2.4. If you intend to
support those versions of Centos and RHEL, then you need to support Python
2.4. If you are prepared to drop support for such systems, then you can
drop support for 2.4 and move on to 2.5 or 2.6. It depends on how much
extra effort you wish to go to in order to support what percentage of your
users. Personally, I find it very annoying when vendors expect you to
upgrade perfectly adequate, still supported systems, and so I try to target
2.4+ when I can. (Also, I am still running a Centos system with 2.4, so I'm
scratching my own itch.)

On the other hand, I once tried to target Python 2.3+. That decision lasted
about two days. The amount of functionality missing from 2.3 compared to
2.4 makes it too painful.

Alternatively, if you don't care about the OS-provided Python (perhaps
you're providing your own, or you expect your users to install from
source), then I think it is acceptable to target 2.7 and 3.3 or better
(e.g. drop support for 3.1 and 3.2). 3.0 is not supported at all -- it was
a buggy release and was quickly dropped for 3.1. If you're not constrained
by yum python3 or apt-get python3, then 3.3 is probably the version you
should aim for.


-- 
Steven

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


Re: unicode to human readable format

2013-12-27 Thread Steven D'Aprano
tomasz.kaczo...@gmail.com wrote:

 hello,
 can I ask you for help? when I try to print s[0] i vane the message:
 UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1:
 ordinal not in range(128). how to solve my problem, please?

What version of Python?

What operating system?

What environment are you running in? IDLE? The shell or cmd.exe? Powershell?
xterm? Something else?

Please copy and paste the complete traceback, starting from the line

Traceback (most recent call last):

to the end.

Please print repr(s[0]) and show us the output.


-- 
Steven

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


Re: So, what's the real story on Python 2 vs Python 3?

2013-12-27 Thread Chris Angelico
On Fri, Dec 27, 2013 at 10:34 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 Alternatively, if you don't care about the OS-provided Python (perhaps
 you're providing your own, or you expect your users to install from
 source), then I think it is acceptable to target 2.7 and 3.3 or better
 (e.g. drop support for 3.1 and 3.2). 3.0 is not supported at all -- it was
 a buggy release and was quickly dropped for 3.1. If you're not constrained
 by yum python3 or apt-get python3, then 3.3 is probably the version you
 should aim for.

That's about the size of it. I'm quite happy to work with a 3.4 alpha,
but when it comes to installation instructions, get this and compile
it is a lot less helpful than install python3 via your OS package
manager (especially since compiling Python from source also means
getting the development versions of whatever modules you need -
apt-getting a bunch of -dev packages, or whatever - and if you don't
get them, some modules mightn't work even though core Python does).
Hence I'd like to stick to OS-provided versions *where reasonable* -
I'm not going to warp my code around Python 2.4 unless there's a large
slab of users on that, but I will restrict myself to Pike 7.8.700
because it's worth the effort.

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


Re: unicode to human readable format

2013-12-27 Thread Ned Batchelder

On 12/27/13 5:43 AM, tomasz.kaczo...@gmail.com wrote:

hello,
can I ask you for help? when I try to print s[0] i vane the message: 
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: 
ordinal not in range(128).
how to solve my problem, please?


regards,
t.



For help with the fundamentals, you can read or watch this PyCon 
presentation:  Pragmatic Unicode, or, How Do I Stop the Pain? 
http://nedbatchelder.com/text/unipain.html




--
Ned Batchelder, http://nedbatchelder.com

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


Re: unicode to human readable format

2013-12-27 Thread Dave Angel
On Fri, 27 Dec 2013 02:43:58 -0800 (PST), tomasz.kaczo...@gmail.com 
wrote:
can I ask you for help? when I try to print s[0] i vane the 
message: UnicodeEncodeError: 'ascii' codec can't encode characters in 
position 0-1: ordinal not in range(128). 

how to solve my problem, please?


First, what version of what os, and what version of python? 

Next,  what terminal are you running,  or what ide, and do you have 
stdout redirected? 

Finally what does your program look like, or at least tell us the 
type and represents of s [0].


Bottom line is that s [0] contains a code point that's larger than 7f 
and print is convinced that your terminal can handle only ASCII.


--
DaveA

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


Re: So, what's the real story on Python 2 vs Python 3?

2013-12-27 Thread Ned Batchelder

On 12/27/13 12:04 AM, Travis McGee wrote:

The Python.org site says that the future is Python 3, yet whenever I try
something new in Python, such as Tkinter which I am learning now,
everything seems to default to Python 2. By this I mean that, whenever I
find that I need to install another package, it shows up as Python 2
unless I explicitly specify Python 3.

What's the deal? If I want to make a distributable software package,
should it be 2 or 3? Enquiring minds want to know.


Choosing between 2 and 3 should be done the same way any version 
decision is made: examine all of your dependencies (libraries, help 
online, skilled helpers available, hosting options, books, etc), then 
choose the highest version that supports them.  Some people still find 
that the answer is 2, but many are finding that it is now 3.  There's a 
lot of FUD about Python 3, don't listen to it.


Certainly don't be thrown by the default of 2.  It doesn't matter what 
most people do, or how your operating system is configured, what matters 
is whether you have what you need.


Note that on sensible operating systems, python will continue to mean 
Python 2, and python3 will mean Python 3.  This will help perpetuate 
the notion that Python 3 is the outlier, but it's the only way to keep 
software working properly.  Don't let it color your perceptions.


If you are going to support both 2 and 3, in addition to the other good 
suggestions in this thread, the six module on PyPI can help with the 
differences.


--
Ned Batchelder, http://nedbatchelder.com

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


Re: Google Groups + this list

2013-12-27 Thread Dave Angel

On Thu, 26 Dec 2013 12:04:22 -0800 (PST), ru...@yahoo.com wrote:

On 12/26/2013 05:41 AM, Chris Angelico wrote:
 On Thu, Dec 26, 2013 at 4:13 PM,  ru...@yahoo.com wrote:
 On 12/25/2013 09:17 PM, Chris Angelico wrote:
[...]
 Or maybe I should have just filtered everything from Google 

Groups
 into the bit bucket, because responding just creates threads 

like
 this. Do you honestly think that would be better? No response 

at all

 if the post comes from GG?

 Do you really think that if *you* ignore Google Groups, then
 Google Groups posters will get no response at all?  Could
 you please turn down your ego a little?
 
 That's not what I said, 



On rereading, my interpretation of your statement still seems 
legitimate.  If you don't clarify, then my response can only 
be: yes, that *is* (in effect) what you said.


It was and still is clear to me what Chris meant. With such a filter, 
clearly he would be making no response at all to such a post.


--
DaveA

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


String Template

2013-12-27 Thread t . giuseppe
Hello

I'm rewriting a program previously written in C #, and trying to keep the same 
configuration file, I have a problem with untapped strings.

The previous configuration files provide an input template string of this type:

input ![CDATA [{ip} - [{date}] HTTP/1.1 GET {url} {?} {?} {referer} 
{useragent}]]/ input


This string is parsed and the values are replaced with the actual values 
written to a log file (apache), then he is given the variable name.

Taking for example a classic line of apache log:

0.0.0.0 - [27/Dec/2013: 00:56:51 +0100] GET / webdav / HTTP/1.1 404 524 - 
Mozilla/5.0 (Windows, U, Windows NT 5.1, en-US , rv: 1.9.2.12) Gecko/20101026 
Firefox/3.6.12 

Is there any way to pull out the values so arranged as follows:

ip = 0.0.0.0
date = 27/Dec/2013: 00:56:51 +0100
url = / webdav /

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


Re: String Template

2013-12-27 Thread Chris Angelico
On Fri, Dec 27, 2013 at 11:55 PM,  t.giuse...@gmail.com wrote:
 I'm rewriting a program previously written in C #, and trying to keep the 
 same configuration file, I have a problem with untapped strings.

Not sure what you mean by untapped here?

 Taking for example a classic line of apache log:

 0.0.0.0 - [27/Dec/2013: 00:56:51 +0100] GET / webdav / HTTP/1.1 404 524 - 
 Mozilla/5.0 (Windows, U, Windows NT 5.1, en-US , rv: 1.9.2.12) 
 Gecko/20101026 Firefox/3.6.12 

 Is there any way to pull out the values so arranged as follows:

 ip = 0.0.0.0
 date = 27/Dec/2013: 00:56:51 +0100
 url = / webdav /


(Aside: Do you really have spaces in your URLs? That seems odd.)

One common way to implement this sort of thing is with a regular
expression. You can either derive a regex from your config file, or
have users directly manage the regex.

For the specific case of parsing the Apache common log format, there's
plenty of material around. This page [1] has a tidy regex that'll do
the job, and this module [2] purports to create a parser by reading
the configuration line that creates it. I don't know anything about
either, save that they came up in a Google search for 'python apache
common log', along with a whole lot of other decent-looking results.

But for a more general solution - supposing you have piles and piles
of those parser strings - I'd be inclined to write a preparser that
reads your config file and derives regex patterns. It needs to figure
out what's a placeholder and what's literal text, then escape the
literal text (if there are regex metacharacters in it) and come up
with some sort of capturing sequence for the placeholder. I don't know
what you'd want there; possibly (.*?) will be the best (that means
capture any number of characters, as few as possible). But you know
your data far better than I do.

ChrisA

[1] http://www.seehuhn.de/blog/52
[2] https://pypi.python.org/pypi/apachelog/1.0
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-27 Thread Steven D'Aprano
On Thu, 19 Dec 2013 19:38:51 -0500, Roy Smith wrote:

 Does anybody ever use D?  I looked at it a few years ago.  It seemed
 like a very good concept.  Sort of C++, with the worst of the crap torn
 out. If nothing else, with the preprocessor torn out :-)
 
 Did it ever go anywhere?

Apparently Facebook are now working with it:

http://www.fastcolabs.com/3019948/more-about-d-language-and-why-facebook-is-experimenting-with-it



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


Re: Brython (Python in the browser)

2013-12-27 Thread Roy Smith
In article 234a1a8d-e491-4eec-8bd5-7931cf4f7...@googlegroups.com,
 Pierre Quentel pierre.quen...@gmail.com wrote:

 Hi,
 
 Ever wanted to use Python instead of Javascript for web client programming ? 
 Take a look at Brython, an implementation of Python 3 in the browser, with an 
 interface with DOM elements and events
 
 Its use is very simple :
 - load the Javascript library brython.js : script src=/path/to/brython.js
 - embed Python code inside a tag script type=text/python
 - run the Python script on page load : body onload=brython()
 
 The Python code is translated into Javascript and executed on the fly
 
 Brython supports the DOM API, HTML5, SVG, with some syntaxic sugar to make 
 the interface more concise (a la jQuery) ; interaction with Javascript 
 libraries is very straightforward. The Brython site provides documentation 
 and many examples
 
 After 1 year of intense development, Brython now covers most of the Python3 
 syntax and can run most of the modules of the Python3.3 standard distribution 
 unmodified, including complex packages like unittest. The team aims at 
 covering 100% of all of Python that makes sense in a browser environment
 
 Home page : http://www.brython.info
 Development site : https://bitbucket.org/olemis/brython/src
 Downloads : https://bitbucket.org/olemis/brython/downloads
 Community : https://groups.google.com/forum/?fromgroups=#!forum/brython

Wow.

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


Re: Brython (Python in the browser)

2013-12-27 Thread jonas . thornvall
Den fredagen den 27:e december 2013 kl. 07:14:35 UTC+1 skrev Pierre Quentel:
 Hi,
 
 
 
 Ever wanted to use Python instead of Javascript for web client programming ? 
 Take a look at Brython, an implementation of Python 3 in the browser, with an 
 interface with DOM elements and events
 
 
 
 Its use is very simple :
 
 - load the Javascript library brython.js : script src=/path/to/brython.js
 
 - embed Python code inside a tag script type=text/python
 
 - run the Python script on page load : body onload=brython()
 
 
 
 The Python code is translated into Javascript and executed on the fly
 
 
 
 Brython supports the DOM API, HTML5, SVG, with some syntaxic sugar to make 
 the interface more concise (a la jQuery) ; interaction with Javascript 
 libraries is very straightforward. The Brython site provides documentation 
 and many examples
 
 
 
 After 1 year of intense development, Brython now covers most of the Python3 
 syntax and can run most of the modules of the Python3.3 standard distribution 
 unmodified, including complex packages like unittest. The team aims at 
 covering 100% of all of Python that makes sense in a browser environment
 
 
 
 Home page : http://www.brython.info
 
 Development site : https://bitbucket.org/olemis/brython/src
 
 Downloads : https://bitbucket.org/olemis/brython/downloads
 
 Community : https://groups.google.com/forum/?fromgroups=#!forum/brython

I am not sure i understand the concept correct it is not serverside, i have to 
install the libraries on my local computer, and it is accessible via 
javascript, not on its own in browsers?

In the future will it always be a library that has to be downloaded and 
installed?

Could in not be implemented like an activeX plugin as flashplayer, when you 
come to a Brython side you have a message to download plugin?

If i understand correct, now one can implement Brython script in JAVASCRIPT 
invoked HTML on a server, but it will not work for people surfing the web 
because the browsers lack support for Brython libraries?

Is Brython thought to be a webapplication or can it read/write to files?
So what is its future?

1. A standard incorporated and implemented by browsers?
2. A plugin like flashplayer?
3. A standalone library to be downloaded and installed on the local computer to 
run python scripts one make?
-- 
https://mail.python.org/mailman/listinfo/python-list


Python in the news

2013-12-27 Thread Travis McGee

From Twitter:

RT @cjbrummitt Python kills security guard at Sanur Hyatt, Bali (Ind). 
bit.ly/1fLCWvn  bad coding has CONSEQUENCES, ppl!

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


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread matt . doolittle33
On Thursday, December 26, 2013 8:29:15 PM UTC-5, Roy Smith wrote:
 In article 59aa73ac-e06e-4c0e-83a4-147ac42ca...@googlegroups.com,
 
  matt.doolittl...@gmail.com wrote:
 
 
 
   In [1]: import time
 
   In [2]: time.time()
 
   Out[2]: 1388085670.1567955
 
  
 
  OK i did what you said but I am only getting 2 decimal places.  
 
  Why is this and what can I do to get the millisecond?  
 
 
 
 What operating system are you on?  The Python time routines can only 
 
 return as much precision as the operating system makes available.

I use Ubuntu 12.10.  Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread matt . doolittle33
 I pretty much stopped using Windows 4 
 
 years ago.
 
I got off the plantation over a year ago and have not looked back. 

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


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread matt . doolittle33
On Thursday, December 26, 2013 11:54:41 PM UTC-5, Dave Angel wrote:
 On Thu, 26 Dec 2013 20:03:34 -0500, Terry Reedy tjre...@udel.edu 
 
 wrote:
 
  On 12/26/2013 5:48 PM, Dave Angel wrote:
 
   You're probably on Windows,  which does time differently.
 
 
 
  With 3.3 and 3.4 on Windows 7, time.time() gives 6 fractional 
 
 digits.
 
import time; time.time()
 
  1388105935.971099
 
 
 
  With 2.7, same machine, I only get 3.
 
 
 
 The way I recall it,  Windows time is a mess. To get better than 10 
 
 ms resolution you needed to use time.clock, but that isn't epoch 
 
 time. Trickier solutions existed, depending on exactly what the 
 
 problem was. But judging from your test, 3.3 built those gyrations 
 
 into the stdlib. I dunno,  I pretty much stopped using Windows 4 
 
 years ago.
 
 
 
 -- 
 
 DaveA

I am on Ubuntu 12.10.   I am still working with the 2 decimal places. Sometime 
ago i had this issue and I forget how i solved it. maybe i used datetime? 
thanks!  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Dave Angel
On Fri, 27 Dec 2013 07:40:29 -0800 (PST), matt.doolittl...@gmail.com 
wrote:
I am on Ubuntu 12.10.   I am still working with the 2 decimal 
places. Sometime ago i had this issue and I forget how i solved it. 
maybe i used datetime? thanks!


Now I'm stumped.  2.7.3 on Ubuntu 12.04 and time.time gives me 6 
decimals. Of course it's a float, so you could get more or fewer. But 
if you're only seeing 2, something else is different.


--
DaveA

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


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Roy Smith
In article 0c33b7e4-edc9-4e1e-b919-fec210c92...@googlegroups.com,
 matt.doolittl...@gmail.com wrote:

 I am on Ubuntu 12.10.   I am still working with the 2 decimal places. 
 Sometime ago i had this issue and I forget how i solved it. maybe i used 
 datetime? thanks!  

That's strange.  Linux should give you time to the microsecond, or 
something in that range.

Please post the *exact* code you're running.  The code you posted 
earlier is obviously only a fragment of some larger program, so we can 
only guess what's happening.  Assuming your program is in a file called 
prog.py, run the following commands and copy-paste the output:

cat /etc/lsb-release

uname -a

python --version

cat prog.py

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


Re: Brython (Python in the browser)

2013-12-27 Thread Johannes Schneider

On 27.12.2013 07:14, Pierre Quentel wrote:

Hi,

Ever wanted to use Python instead of Javascript for web client programming ? 
Take a look at Brython, an implementation of Python 3 in the browser, with an 
interface with DOM elements and events

Its use is very simple :
- load the Javascript library brython.js : script src=/path/to/brython.js
- embed Python code inside a tag script type=text/python
- run the Python script on page load : body onload=brython()

The Python code is translated into Javascript and executed on the fly

Brython supports the DOM API, HTML5, SVG, with some syntaxic sugar to make the 
interface more concise (a la jQuery) ; interaction with Javascript libraries is 
very straightforward. The Brython site provides documentation and many examples

After 1 year of intense development, Brython now covers most of the Python3 
syntax and can run most of the modules of the Python3.3 standard distribution 
unmodified, including complex packages like unittest. The team aims at covering 
100% of all of Python that makes sense in a browser environment

Home page : http://www.brython.info
Development site : https://bitbucket.org/olemis/brython/src
Downloads : https://bitbucket.org/olemis/brython/downloads
Community : https://groups.google.com/forum/?fromgroups=#!forum/brython



that's amazing.
is there any python construct which is not usable with brython? OR, the 
oder way around, anything possible in JS, which does not work in brython?


bg,
Johannes



--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: cascading python executions only if return code is 0

2013-12-27 Thread Roy Smith
In article mailman.4668.1388160953.18130.python-l...@python.org,
 Dennis Lee Bieber wlfr...@ix.netcom.com wrote:

 On Thu, 26 Dec 2013 23:29:30 -0500, Roy Smith r...@panix.com declaimed the
 following:
 
 
 NTP is never supposed to move the clock backwards.  If your system clock 
 is fast, it's supposed to reduce the rate your clock runs until it's 
 back in sync.  Well, maybe it only does that for small corrections?
 
   Especially likely when one considers that M$ Windows only does a time
 synch once a week.

When I attempt to reason about what is possible and what is impossible 
in a program, I assume a sane universe.  Windows violates that 
assumption.  I am not responsible for what happens after that.

People complain that Python 3 has been out for 5 years and the world is 
still dragging its feet upgrading from Python 2.  NTP has been around 
for almost 30 years.

Keeping a bunch of clocks on a network in sync is a solved problem.  The 
world really needs to move on to new problems like how to deal with more 
than 2^32 devices on a network.  Or how to deal with languages where 26 
letters isn't enough.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: cascading python executions only if return code is 0

2013-12-27 Thread Rustom Mody
On Fri, Dec 27, 2013 at 10:12 PM, Roy Smith wrote:
 In article mailman.4668.1388160953.18130.python-l...@python.org,
  Dennis Lee Bieber  wrote:

 On Thu, 26 Dec 2013 23:29:30 -0500, Roy Smith r...@panix.com declaimed the
 following:

 
 NTP is never supposed to move the clock backwards.  If your system clock
 is fast, it's supposed to reduce the rate your clock runs until it's
 back in sync.  Well, maybe it only does that for small corrections?

   Especially likely when one considers that M$ Windows only does a time
 synch once a week.

 When I attempt to reason about what is possible and what is impossible
 in a program, I assume a sane universe.

Hmm...
Any clues for a pathway to this alternate universe?
:D
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [OT]Royal pardon for codebreaker Turing

2013-12-27 Thread Mark Lawrence

On 24/12/2013 05:07, Steven D'Aprano wrote:

On Tue, 24 Dec 2013 00:32:31 +, Mark Lawrence wrote:


Maybe of interest to some of you
http://www.bbc.co.uk/news/technology-25495315


While I'm happy for Alan Turing, may he rest in peace, I think the
thousands of other homosexuals who have been prosecuted for something
which shouldn't be a crime in the first place might be a bit peeved that
he is singled out for a pardon.

Personally, I think that people ought to throw a party celebrating
Turing's rehabilitation, and do it right outside the Russian Embassy.



Any particular reason for the restriction to Russian Embassy?

--
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: Brython (Python in the browser)

2013-12-27 Thread Pierre Quentel
Le vendredi 27 décembre 2013 15:56:33 UTC+1, jonas.t...@gmail.com a écrit :
 Den fredagen den 27:e december 2013 kl. 07:14:35 UTC+1 skrev Pierre Quentel:
 
  Hi,
 
  
 
  
 
  
 
  Ever wanted to use Python instead of Javascript for web client programming 
  ? Take a look at Brython, an implementation of Python 3 in the browser, 
  with an interface with DOM elements and events
 
  
 
  
 
  
 
  Its use is very simple :
 
  
 
  - load the Javascript library brython.js : script 
  src=/path/to/brython.js
 
  
 
  - embed Python code inside a tag script type=text/python
 
  
 
  - run the Python script on page load : body onload=brython()
 
  
 
  
 
  
 
  The Python code is translated into Javascript and executed on the fly
 
  
 
  
 
  
 
  Brython supports the DOM API, HTML5, SVG, with some syntaxic sugar to make 
  the interface more concise (a la jQuery) ; interaction with Javascript 
  libraries is very straightforward. The Brython site provides documentation 
  and many examples
 
  
 
  
 
  
 
  After 1 year of intense development, Brython now covers most of the Python3 
  syntax and can run most of the modules of the Python3.3 standard 
  distribution unmodified, including complex packages like unittest. The team 
  aims at covering 100% of all of Python that makes sense in a browser 
  environment
 
  
 
  
 
  
 
  Home page : http://www.brython.info
 
  
 
  Development site : https://bitbucket.org/olemis/brython/src
 
  
 
  Downloads : https://bitbucket.org/olemis/brython/downloads
 
  
 
  Community : https://groups.google.com/forum/?fromgroups=#!forum/brython
 
 
 
 I am not sure i understand the concept correct it is not serverside, i have 
 to install the libraries on my local computer, and it is accessible via 
 javascript, not on its own in browsers?
 
 
 
 In the future will it always be a library that has to be downloaded and 
 installed?
 
 
 
 Could in not be implemented like an activeX plugin as flashplayer, when you 
 come to a Brython side you have a message to download plugin?
 
 
 
 If i understand correct, now one can implement Brython script in JAVASCRIPT 
 invoked HTML on a server, but it will not work for people surfing the web 
 because the browsers lack support for Brython libraries?
 
 
 
 Is Brython thought to be a webapplication or can it read/write to files?
 
 So what is its future?
 
 
 
 1. A standard incorporated and implemented by browsers?
 
 2. A plugin like flashplayer?
 
 3. A standalone library to be downloaded and installed on the local computer 
 to run python scripts one make?

Brython is made for client-side web programming, ie programs executing in a web 
browser. To be able to use it, all there is to do is upload the Brython 
distribution on the same server as the HTML pages

Since it is written in standard Javascript, it is designed to be cross-browser 
; it is tested on Chrome and Firefox, and is known to work with a few 
limitations on IE10
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: cascading python executions only if return code is 0

2013-12-27 Thread Mark Lawrence

On 27/12/2013 01:44, Chris Angelico wrote:

On Fri, Dec 27, 2013 at 12:37 PM, Roy Smith r...@panix.com wrote:

In article mailman.4567.1387819120.18130.python-l...@python.org,
  Ethan Furman et...@stoneleaf.us wrote:


Mostly I don't want newbies thinking Hey!  I can use assertions for all my
confidence testing!


How about this one, that I wrote yesterday;

 assert second = self.current_second, time went backwards

I think that's pretty high up on the can never happen list.


assert second = self.current_second, user changed the clock

ChrisA



assert shoot admin who gave user too much privilege ?

--
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: Brython (Python in the browser)

2013-12-27 Thread Pierre Quentel
Le vendredi 27 décembre 2013 17:12:09 UTC+1, Johannes Schneider a écrit :
 On 27.12.2013 07:14, Pierre Quentel wrote:
 
  Hi,
 
 
 
  Ever wanted to use Python instead of Javascript for web client programming 
  ? Take a look at Brython, an implementation of Python 3 in the browser, 
  with an interface with DOM elements and events
 
 
 
  Its use is very simple :
 
  - load the Javascript library brython.js : script 
  src=/path/to/brython.js
 
  - embed Python code inside a tag script type=text/python
 
  - run the Python script on page load : body onload=brython()
 
 
 
  The Python code is translated into Javascript and executed on the fly
 
 
 
  Brython supports the DOM API, HTML5, SVG, with some syntaxic sugar to make 
  the interface more concise (a la jQuery) ; interaction with Javascript 
  libraries is very straightforward. The Brython site provides documentation 
  and many examples
 
 
 
  After 1 year of intense development, Brython now covers most of the Python3 
  syntax and can run most of the modules of the Python3.3 standard 
  distribution unmodified, including complex packages like unittest. The team 
  aims at covering 100% of all of Python that makes sense in a browser 
  environment
 
 
 
  Home page : http://www.brython.info
 
  Development site : https://bitbucket.org/olemis/brython/src
 
  Downloads : https://bitbucket.org/olemis/brython/downloads
 
  Community : https://groups.google.com/forum/?fromgroups=#!forum/brython
 
 
 
 
 
 that's amazing.
 
 is there any python construct which is not usable with brython? OR, the 
 
 oder way around, anything possible in JS, which does not work in brython?
 
 
 
 bg,
 
 Johannes
 
 
 
 
 
 
 
 -- 
 
 Johannes Schneider
 
 Webentwicklung
 
 johannes.schnei...@galileo-press.de
 
 Tel.: +49.228.42150.xxx
 
 
 
 Galileo Press GmbH
 
 Rheinwerkallee 4 - 53227 Bonn - Germany
 
 Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
 
 http://www.galileo-press.de/
 
 
 
 Gesch�ftsf�hrer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
 
 HRB 8363 Amtsgericht Bonn

The documentation maintains a list of Python features that are not supported 
yet. For most of them, it's just a question of time and work by the development 
team

The only thing that is difficult to implement correctly is generators, since 
only few Javascript engines support yield. Brython implementation is not 
perfect, but for the moment it doesn't break any of the modules in the standard 
distribution that have been included

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


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread matt . doolittle33
On Friday, December 27, 2013 11:27:58 AM UTC-5, Roy Smith wrote:
 In article 0c33b7e4-edc9-4e1e-b919-fec210c92...@googlegroups.com,
 
  matt.doolittl...@gmail.com wrote:
 
 
 
  I am on Ubuntu 12.10.   I am still working with the 2 decimal places. 
 
  Sometime ago i had this issue and I forget how i solved it. maybe i used 
 
  datetime? thanks!  
 
 
 
 That's strange.  Linux should give you time to the microsecond, or 
 
 something in that range.
 
 
 
 Please post the *exact* code you're running.  The code you posted 
 
 earlier is obviously only a fragment of some larger program, so we can 
 
 only guess what's happening.  Assuming your program is in a file called 
 
 prog.py, run the following commands and copy-paste the output:
 
 
i cant run it that way.  i tried using the python prompt in terminal but got 
nothing.  but here is all the code relevant to this issue:
#all the imports
import sys
import posixpath
import time
from time import strftime
from datetime import datetime
import os
import wx
import cPickle as pickle
import gnuradio.gr.gr_threading as _threading


#the function that writes the time values
 def update(self, field_values):

now = datetime.now()

#logger ---
#  new line to write on
self.logfile.write('\n')
#  write date, time, and seconds from the epoch
self.logfile.write('%s\t'%(strftime(%Y-%m-%d,)))
self.logfile.write('%s\t'%(now.strftime(%H:%M:%S,)))
self.logfile.write('%s\t'%(time.time()))
# list to store dictionary keys in tis order
keys = [duid, nac,  tgid, source, algid, kid]
# loop through the keys in the right order
for k in keys:
#  get the value of the current key
f = field_values.get(k, None)
# if data unit has value...
if f:
#  output the value with trailing tab
self.logfile.write('%s\t'%(str(f)))  
# if data unit doesnt have this value print a tab
else:
self.logfile.write('\t')
#end logger 

#if the field 'duid' == 'hdu', then clear fields
if field_values['duid'] == 'hdu':
self.clear()
elif field_values['duid'] == 'ldu1':
self.clear()
elif field_values['duid'] == 'ldu2':
self.clear()
#elif field_values['duid'] == 'tdu':
 #   self.clear()
#loop through all TextCtrl fields storing the key/value pairs in k, v
for k,v in self.fields.items():
# get the dict value for this TextCtrl
f = field_values.get(k, None)
# if the value is empty then set the new value
if f:
v.SetValue(f)

#sample output in a .txt file:

2013-12-27  12:07:331388164053.18
2013-12-27  12:07:331388164053.36
2013-12-27  12:07:331388164053.54
2013-12-27  12:07:331388164053.73
2013-12-27  12:07:331388164053.91
2013-12-27  12:07:341388164054.11
2013-12-27  12:07:341388164054.28
2013-12-27  12:07:341388164054.48
2013-12-27  12:07:341388164054.66
2013-12-27  12:07:341388164054.84
2013-12-27  12:07:371388164057.62
2013-12-27  12:07:371388164057.81
2013-12-27  12:07:371388164057.99
2013-12-27  12:07:381388164058.18
2013-12-27  12:07:381388164058.37
2013-12-27  12:07:381388164058.54
2013-12-27  12:07:381388164058.73
2013-12-27  12:07:381388164058.92

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


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Ned Batchelder

On 12/27/13 1:09 PM, matt.doolittl...@gmail.com wrote:

On Friday, December 27, 2013 11:27:58 AM UTC-5, Roy Smith wrote:

In article 0c33b7e4-edc9-4e1e-b919-fec210c92...@googlegroups.com,

  matt.doolittl...@gmail.com wrote:




I am on Ubuntu 12.10.   I am still working with the 2 decimal places.



Sometime ago i had this issue and I forget how i solved it. maybe i used



datetime? thanks!




That's strange.  Linux should give you time to the microsecond, or

something in that range.



Please post the *exact* code you're running.  The code you posted

earlier is obviously only a fragment of some larger program, so we can

only guess what's happening.  Assuming your program is in a file called

prog.py, run the following commands and copy-paste the output:



i cant run it that way.  i tried using the python prompt in terminal but got 
nothing.  but here is all the code relevant to this issue:
#all the imports
import sys
import posixpath
import time
from time import strftime
from datetime import datetime
import os
import wx
import cPickle as pickle
import gnuradio.gr.gr_threading as _threading


#the function that writes the time values
  def update(self, field_values):

 now = datetime.now()

 #logger ---
 #  new line to write on
 self.logfile.write('\n')
 #  write date, time, and seconds from the epoch
 self.logfile.write('%s\t'%(strftime(%Y-%m-%d,)))
 self.logfile.write('%s\t'%(now.strftime(%H:%M:%S,)))
 self.logfile.write('%s\t'%(time.time()))
 # list to store dictionary keys in tis order
 keys = [duid, nac,  tgid, source, algid, kid]
 # loop through the keys in the right order
 for k in keys:
 #  get the value of the current key
 f = field_values.get(k, None)
 # if data unit has value...
 if f:
 #  output the value with trailing tab
 self.logfile.write('%s\t'%(str(f)))
 # if data unit doesnt have this value print a tab
 else:
 self.logfile.write('\t')
 #end logger 

 #if the field 'duid' == 'hdu', then clear fields
 if field_values['duid'] == 'hdu':
 self.clear()
 elif field_values['duid'] == 'ldu1':
 self.clear()
 elif field_values['duid'] == 'ldu2':
 self.clear()
 #elif field_values['duid'] == 'tdu':
  #   self.clear()
 #loop through all TextCtrl fields storing the key/value pairs in k, v
 for k,v in self.fields.items():
 # get the dict value for this TextCtrl
 f = field_values.get(k, None)
 # if the value is empty then set the new value
 if f:
 v.SetValue(f)

#sample output in a .txt file:

2013-12-27  12:07:331388164053.18
2013-12-27  12:07:331388164053.36
2013-12-27  12:07:331388164053.54
2013-12-27  12:07:331388164053.73
2013-12-27  12:07:331388164053.91
2013-12-27  12:07:341388164054.11
2013-12-27  12:07:341388164054.28
2013-12-27  12:07:341388164054.48
2013-12-27  12:07:341388164054.66
2013-12-27  12:07:341388164054.84
2013-12-27  12:07:371388164057.62
2013-12-27  12:07:371388164057.81
2013-12-27  12:07:371388164057.99
2013-12-27  12:07:381388164058.18
2013-12-27  12:07:381388164058.37
2013-12-27  12:07:381388164058.54
2013-12-27  12:07:381388164058.73
2013-12-27  12:07:381388164058.92

Thanks!



Instead of:

%s % time.time()

try:

%.6f % time.time()

%.6f is a formatting code meaning, floating-point number, 6 decimal places.

--
Ned Batchelder, http://nedbatchelder.com

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


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Roy Smith
In article 1db0d993-9d2d-46af-9ee8-69d9250dc...@googlegroups.com,
 matt.doolittl...@gmail.com wrote:

  Please post the *exact* code you're running.  The code you posted 
  earlier is obviously only a fragment of some larger program, so we can 
  only guess what's happening.  Assuming your program is in a file called 
  prog.py, run the following commands and copy-paste the output:
  
 i cant run it that way.  i tried using the python prompt in terminal but got 
 nothing.

Why can't you run it that way?  What does got nothing mean?  Did you 
just get another shell prompt back with no output?  Did your shell 
window close?  Did the machine crash?

I asked you to run these commands:

 cat /etc/lsb-release
 
 uname -a
 
 python --version

Did you run them?  What output did you get?  I know it seems silly, but 
it really is important that people know exactly what your environment 
is.  The less information we have, the harder it is to figure out what's 
going on.

 but here is all the code relevant to this issue:

Well, you've got a lot of code there.  What you want to do is reduce 
this down to the smallest possible amount of code which demonstrates the 
problem.

I can't even begin to run your code here because I don't have gnuradio 
installed.  It's almost certainly not necessary to demonstrate the 
problem (nor are posixpath, cPickle, wx, etc), but I can already see 
that as soon as I delete those, I'll run up against the next problem, 
which is that update() is a method of a class and I don't have the rest 
of that class.

Let's take this one step at a time.  You've got:

self.logfile.write('%s\t'%(time.time()))

which is apparently causing, 1388164053.18, to end up in your output 
file.  The question is, why are there only two digits after the decimal 
place?  Possible causes:

1) Your version of time.time() is returning a float which is only 
precise to the centisecond.

2) Your version of string's %s operator is only converting floats to two 
decimal places.

3) Your self.logfile.write() method is taking the string it was given 
and stripping off all the digits beyond two after the decimal point.

All of those seem about equally unlikely, so just start to eliminate 
them one by one.  What happens if you do:

self.logfile.write(1388164053.183454)

What happens if you do:

t = time.time()
self.logfile.write(str=%s, repr=%s, (str(t), repr(t)))

what happens if you get rid of the whole self.logfile.write() thing and 
just use print?  If you're working in some environment where stdout gets 
redirected somewhere that you can't find, bypass stdout completely:

my_file = open(/tmp/foo, w)
print  my_file, time.time()

and then go look and see what got dropped into /tmp/foo.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Roy Smith
In article roy-4a275d.13503227122...@news.panix.com,
 Roy Smith r...@panix.com wrote:

 self.logfile.write(str=%s, repr=%s, (str(t), repr(t)))

Ugh, make that:

 self.logfile.write(str=%s, repr=%s % ((str(t), repr(t)))
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Brython (Python in the browser)

2013-12-27 Thread billy . earney
Awesome..  Wonderful work!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python in the news

2013-12-27 Thread Larry Martell
John D. MacDonald fan?

On Friday, December 27, 2013, Travis McGee wrote:

 From Twitter:

 RT @cjbrummitt Python kills security guard at Sanur Hyatt, Bali (Ind).
 bit.ly/1fLCWvn  bad coding has CONSEQUENCES, ppl!
 --
 https://mail.python.org/mailman/listinfo/python-list

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


Re: [OT]Royal pardon for codebreaker Turing

2013-12-27 Thread Tim Delaney
On 28 December 2013 04:34, Mark Lawrence breamore...@yahoo.co.uk wrote:


 Personally, I think that people ought to throw a party celebrating
 Turing's rehabilitation, and do it right outside the Russian Embassy.


 Any particular reason for the restriction to Russian Embassy?


I suspect it's in reference to the difficulties homosexuals are likely to
face when attending or competing in the 2014 Winter Olympic and Paralympic
Games at Sochi. Adam Hills in particular has had a real go about it on his
UK show The Last Leg where he decided to turn Vladimir Putin into a
homosexual icon (search last leg sochi without the quotes).

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


eclipse+pyDev code complete problem

2013-12-27 Thread zhaoyunsong
dear all,
I am trying to configure eclipse + pydev as my ide, but there seems to be some 
problem on code complete.
the attached is the case when code complete does not work. any suggestions? 
Thanks!


my system is win 64bit
pyhon 3.3 64bit
eclipse kepler-SR1
pydev 3.1
I downloaded pillow from this website:http://www.lfd.uci.edu/~gohlke/pythonlibs/


Yunsong Zhaoattachment: 无标题.png-- 
https://mail.python.org/mailman/listinfo/python-list


Re: cascading python executions only if return code is 0

2013-12-27 Thread Chris Angelico
On Sat, Dec 28, 2013 at 3:42 AM, Roy Smith r...@panix.com wrote:
 Keeping a bunch of clocks on a network in sync is a solved problem.  The
 world really needs to move on to new problems like how to deal with more
 than 2^32 devices on a network.  Or how to deal with languages where 26
 letters isn't enough.

*clap* Very tidy, finding two examples that were both solved in 1996. I like.

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


Re: Variables in a loop, Newby question

2013-12-27 Thread vanommen . robert
Op dinsdag 24 december 2013 17:23:43 UTC+1 schreef Jean-Michel Pichavant:
 - Original Message -
  Hello, for the first time I'm trying te create a little Python
  program. (on a raspberri Pi)
  
  I don't understand the handling of variables in a loop with Python.
  
  
  Lets say i want something like this.
  
  x = 1
  while x  10
  var x = x
  x = x + 1
  
  The results must be:
  
  var1 = 1
  var2 = 2
  
  enz. until var9 = 9
  
  How do i program this in python?
 
 Short story, cause it's almost xmas eve :D:
 
 python 2.5:
 
 var = {}
 for i in range(10):
   var[i] = i
 
 print var[1]
 print var[2]
 print var
 
 var here is a dictionary. I suggest that you read through the python tutorial 
 :)
 
 JM
 
 
 -- IMPORTANT NOTICE: 
 
 The contents of this email and any attachments are confidential and may also 
 be privileged. If you are not the intended recipient, please notify the 
 sender immediately and do not disclose the contents to any other person, use 
 it for any purpose, or store or copy the information in any medium. Thank you.

This was the information I was looking for and what my first question was 
about. Got this working, Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: cascading python executions only if return code is 0

2013-12-27 Thread pecore
Roy Smith r...@panix.com writes:

 Or how to deal with languages where 26 letters isn't enough.

English! that is, imvho
English is in sore need
of some more letters[*]
and of diacriticals too
  g
[*] unable to quantify!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Cameron Simpson
On 27Dec2013 07:40, matt.doolittl...@gmail.com matt.doolittl...@gmail.com 
wrote:
 I am on Ubuntu 12.10.   I am still working with the 2 decimal
 places. Sometime ago i had this issue and I forget how i solved it.
 maybe i used datetime? thanks!

Repeatedly people have asked you to show your exact code. Still nothing.

Here's a clue, from a Gentoo box running kernel 3.2.1-gentoo-r2:

  $ python
  Python 2.7.2 (default, Feb  9 2012, 18:40:46)
  [GCC 4.5.3] on linux2
  Type help, copyright, credits or license for more information.
   import time; print time.time()
  1388190100.44
   import time; time.time()
  1388190102.795531
  

Please show us _exactly_ what you're doing. I'm guessing that print
is confusing you.

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

Try moving off NT easily.  You can move from Solaris to HP/UX to AIX or
DEC easily-- relative to moving off of NT, which is like a Roach
Motel.  Once you check in, you never check out.
- Scott McNealy, Sun Microsystems
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Roy Smith
matt.doolittl...@gmail.com wrote:
 I need to print the time in seconds from the epoch with 
 millisecond precision.  

I wrote:

 What happens if you do:
 
 t = time.time()
 self.logfile.write(str=%s, repr=%s, (str(t), repr(t)))

At the time I originally posted that, I was baffled as to what was going 
on and was simply feeding you suggestions for how to go about debugging 
the problem logically.

However, I have since figured out exactly what's going on.  I'm going to 
do you a favor and NOT tell you what I've figured out (because you won't 
learn anything that way), but I will give you a hint.  The hint is that 
if you run the two lines of code I suggested above, the answer should be 
obvious.

And, once you do that, please report your findings back to us, because 
it's a fun little quirk of Python and one that I suspect has tripped up 
more than a few people over time.  In fact, I seem to recall being 
mystified by this myself once.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Ned Batchelder

On 12/27/13 7:25 PM, Cameron Simpson wrote:

On 27Dec2013 07:40, matt.doolittl...@gmail.com matt.doolittl...@gmail.com 
wrote:

I am on Ubuntu 12.10.   I am still working with the 2 decimal
places. Sometime ago i had this issue and I forget how i solved it.
maybe i used datetime? thanks!


Repeatedly people have asked you to show your exact code. Still nothing.


Is something wrong with the connectivity of this list?  Matt posted his 
code about six hours before your message.


--
Ned Batchelder, http://nedbatchelder.com

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


Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Steven D'Aprano
On Fri, 27 Dec 2013 21:10:49 -0500, Ned Batchelder wrote:

 On 12/27/13 7:25 PM, Cameron Simpson wrote:
 On 27Dec2013 07:40, matt.doolittl...@gmail.com
 matt.doolittl...@gmail.com wrote:
 I am on Ubuntu 12.10.   I am still working with the 2 decimal places.
 Sometime ago i had this issue and I forget how i solved it. maybe i
 used datetime? thanks!

 Repeatedly people have asked you to show your exact code. Still
 nothing.
 
 Is something wrong with the connectivity of this list?  Matt posted his
 code about six hours before your message.

Methinks too many people have been hitting the Christmas eggnog a little 
harder than is wise...

:-)




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


Re: [OT]Royal pardon for codebreaker Turing

2013-12-27 Thread Steven D'Aprano
On Sat, 28 Dec 2013 07:30:34 +1100, Tim Delaney wrote:

 On 28 December 2013 04:34, Mark Lawrence breamore...@yahoo.co.uk
 wrote:
 
 
 Personally, I think that people ought to throw a party celebrating
 Turing's rehabilitation, and do it right outside the Russian Embassy.


 Any particular reason for the restriction to Russian Embassy?
 
 
 I suspect it's in reference to the difficulties homosexuals are likely
 to face when attending or competing in the 2014 Winter Olympic and
 Paralympic Games at Sochi.

I don't care about the Olympians. Their presence in Russia is voluntary, 
and so long as they keep it in their pants for a few weeks (or at least 
don't get caught) they get to go home again a few weeks later. Have a 
thought for those who don't get to go home again. I'm talking about the 
situation in Russia, where the government is engaging in 1930s-style 
scape-goating and oppression of homosexuals. They haven't quite reached 
the level of Kristallnacht or concentration camps, but the rhetoric and 
laws coming out of the Kremlin are just like that coming out of the 
Reichstag in the thirties.



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


Re: [OT]Royal pardon for codebreaker Turing

2013-12-27 Thread Tim Delaney
On 28 December 2013 15:16, Steven D'Aprano st...@pearwood.info wrote:

 I don't care about the Olympians. Their presence in Russia is voluntary,
 and so long as they keep it in their pants for a few weeks (or at least
 don't get caught) they get to go home again a few weeks later. Have a
 thought for those who don't get to go home again. I'm talking about the
 situation in Russia, where the government is engaging in 1930s-style
 scape-goating and oppression of homosexuals. They haven't quite reached
 the level of Kristallnacht or concentration camps, but the rhetoric and
 laws coming out of the Kremlin are just like that coming out of the
 Reichstag in the thirties.


You are of course correct - I was still groggy from waking up when I
replied, and focused on the element that I had been most exposed to.

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


Re: unicode to human readable format

2013-12-27 Thread wxjmfauth
Le vendredi 27 décembre 2013 12:37:17 UTC+1, Steven D'Aprano a écrit :
 tomasz.kaczo...@gmail.com wrote:
 
 
 
  hello,
 
  can I ask you for help? when I try to print s[0] i vane the message:
 
  UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1:
 
  ordinal not in range(128). how to solve my problem, please?
 
 
 
 What version of Python?
 
 
 
 What operating system?
 
 
 
 What environment are you running in? IDLE? The shell or cmd.exe? Powershell?
 
 xterm? Something else?
 
 
 
 Please copy and paste the complete traceback, starting from the line
 
 
 
 Traceback (most recent call last):
 
 
 
 to the end.
 
 
 
 Please print repr(s[0]) and show us the output.
 
 


What do you expect?
The representation is - and should be -

 print repr(s[0])
u'\u0105\u017c\u0119\u0142\u0144'

independently of the tool one uses to process such
a code.


Now, if one prints s[0], the result may be - and should be -
different from the tool.


win console, cp850

 print s[0]
Traceback (most recent call last):
  File stdin, line 1, in module
  File c:\python27\lib\encodings\cp850.py, line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-4: cha
racter maps to undefined



win console, cp1252

 print s[0]
Traceback (most recent call last):
  File stdin, line 1, in module
  File c:\python27\lib\encodings\cp1252.py, line 12, in encode
return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-4: cha
racter maps to undefined


win console, cp1250

 s = [u'\u0105\u017c\u0119\u0142\u0144']
 print s[0]
ążęłń



SciTE editor, output pane locale, cp1252 for me.

Traceback (most recent call last):
  File utrick.py, line 18, in module
print u'\u0105\u017c\u0119\u0142\u0144'
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: 
ordinal not in range(128)
Exit code: 1


SciTE editor, output pane 65001

Traceback (most recent call last):
  File utrick.py, line 18, in module
print u'\u0105\u017c\u0119\u0142\u0144'
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: 
ordinal not in range(128)
Exit code: 1


Now in IDLE, Western European version of Windows, 
one get this

 print s[0]
ążęłń

Note, by chance it is printing something. It may
come it does not print, understand, render chars
at all. *This is wrong*.



My interactive interpreter I wrote for Py2.*
(full of dirty tricks).

 print repr(s[0])
u'\u0105\u017c\u0119\u0142\u0144'
 print s[0]
?

*This is correct*, it is an expected result and it
works for all chars.



A (the) correct way to print s[0] with a console (all
platforms).

 print s[0].encode(sys.stdout.encoding, 'replace')
?



See the another thread about printing repr().


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


[issue20075] help(open) eats first line

2013-12-27 Thread Vajrasky Kok

Vajrasky Kok added the comment:

The patch does not fix it. It becomes like this:

open(...)
Open file and return a stream.  Raise IOError upon failure.

It's not just help(open) has problem, help(sqlite3.connect) got it as well:

connect(...)
check_same_thread, factory, cached_statements, uri])

Opens a connection to the SQLite database file *database*. You can use

--
nosy: +vajrasky

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



[issue19944] Make importlib.find_spec load packages as needed

2013-12-27 Thread Eric Snow

Eric Snow added the comment:

Any thoughts on the latest patch?

--

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



[issue20078] zipfile - ZipExtFile.read goes into 100% CPU infinite loop on maliciously binary edited zips

2013-12-27 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka
nosy: +serhiy.storchaka
stage:  - needs patch
versions: +Python 3.4

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



[issue20078] zipfile - ZipExtFile.read goes into 100% CPU infinite loop on maliciously binary edited zips

2013-12-27 Thread Ronald Oussoren

Changes by Ronald Oussoren ronaldousso...@mac.com:


--
nosy: +ronaldoussoren

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



[issue20079] Add support for glibc supported locales

2013-12-27 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch adds to locale alias table the mappings for locales supported in 
recent glibc (v 2.18). It also modifies the makelocalealias.py script so that 
it parses the SUPPORTED file from glibc sources and supports command line 
options for source paths.

--
components: Library (Lib)
files: locale_glibc_supported.patch
keywords: patch
messages: 206987
nosy: lemburg, loewis, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add support for glibc supported locales
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33278/locale_glibc_supported.patch

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



[issue20079] Add support for glibc supported locales

2013-12-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Totally added 100 new mappings.

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Larry Hastings

Larry Hastings added the comment:

The best fix would be to convert the docstrings to something inspect can parse. 
 Preferably by converting the functions to use Argument Clinic, though you 
could manually mark up the docstring by hand if necessary.

--

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



[issue20080] Unused variable in Lib/sqlite3/test/factory.py

2013-12-27 Thread Vajrasky Kok

New submission from Vajrasky Kok:

There is unused variable t in Lib/sqlite3/test/factory.py.

def CheckSqliteRowAsTuple(self):
Checks if the row object can be converted to a tuple
self.con.row_factory = sqlite.Row
row = self.con.execute(select 1 as a, 2 as b).fetchone()
t = tuple(row)

def CheckSqliteRowAsDict(self):

Attached the patch to give the purpose to variable t.

--
components: Tests
files: unused_variable_in_factory_py.patch
keywords: patch
messages: 206990
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Unused variable in Lib/sqlite3/test/factory.py
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33279/unused_variable_in_factory_py.patch

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

  import io
  io.TextIOWrapper(open(/dev/tty, rb+))
 
 Traceback (most recent call last):
   File stdin, line 1, in module
 io.UnsupportedOperation: File or stream is not seekable.

buffering=0

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 The best fix would be to convert the docstrings to something inspect can
 parse.  Preferably by converting the functions to use Argument Clinic,
 though you could manually mark up the docstring by hand if necessary.

We can't check all docstrings in the stdlib and in all third-party libraries.

--

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



[issue9351] argparse set_defaults on subcommands should override top level set_defaults

2013-12-27 Thread Mikael Knutsson

Mikael Knutsson added the comment:

Just wanted to drop in here to let you know that I hit this behaviour recently 
when writing a small tool using both configparser and argparse and the 
workaround proves rather annoying (custom namespace object or similar).

Would be awesome if this moved forward with the proposed patch!

--
nosy: +mikn

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

Yes, so basically signature line in help(open) is not shown because ast.parse 
fails to parse the return value

- file object

According to grammar, it should be 
- file 
or 
- 'file object' 
or something like this.

as for sqlite, it fails to parse square brackets:

connect(database[, timeout, detect_types, isolation_level,\n\
check_same_thread, factory, cached_statements, uri])

As an idea, maybe we can come up with a failover i.e. if ast can't parse the 
signature, just use __text_signature__ instead of signature object:

Lib/pydoc.py:1325
if not argspec:
-   argspec = '(...)'
+   argspec = object.__text_signature__


Or probably just don't show the signature if it is not formatted correctly as 
it is now (after the patch applied).

--

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



[issue19944] Make importlib.find_spec load packages as needed

2013-12-27 Thread Nick Coghlan

Nick Coghlan added the comment:

The simple patch actually looks like a good way to end up with find_spec 
specific bugs because it diverges from the more thoroughly tested main import 
path (e.g. it looks to me like it doesn't release the import lock properly)

So the _FoundSpec version actually looks better to me, because it keeps 
find_spec more inline with actual imports.

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Zachary Ware

Zachary Ware added the comment:

The patch looks good to me (aside from extra whitespace on the blank lines in 
methodobject.c, and I agree with Serhiy about s/brackets/parens/).  Also, I 
like the suggestion of using __text_signature__ instead of '(...)'.  However, 
just to avoid any possible issues with __text_signature__ being blank or 
missing, I would go with `argspec = getattr(object, '__text_signature__', '') 
or '(...)'` instead of straight `object.__text_signature__` (and note that 
there are two places to change in pydoc).

--

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



[issue20080] Unused variable in Lib/sqlite3/test/factory.py

2013-12-27 Thread Eric V. Smith

Eric V. Smith added the comment:

I think you want to either also testing the number of elements in t, or in just 
compare t to (row[a], row[b]) (untested).

--
nosy: +eric.smith

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Dolda2000

Dolda2000 added the comment:

Oh sorry, my bad. I messed up. :)

Given that that works, though, why can't open() handle opening /dev/tty 
directly in text mode? Clearly, TextIOWrapper can handle the necessary 
buffering without the stream having to be seekable.

--

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



[issue17484] add tests for getpass

2013-12-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 100f632d4306 by R David Murray in branch '3.3':
#18116: backport fix to 3.3 since real-world failure mode demonstrated.
http://hg.python.org/cpython/rev/100f632d4306

--

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 100f632d4306 by R David Murray in branch '3.3':
#18116: backport fix to 3.3 since real-world failure mode demonstrated.
http://hg.python.org/cpython/rev/100f632d4306

--
nosy: +python-dev

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



[issue18116] getpass.unix_getpass() always fallback to sys.stdin

2013-12-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 100f632d4306 by R David Murray in branch '3.3':
#18116: backport fix to 3.3 since real-world failure mode demonstrated.
http://hg.python.org/cpython/rev/100f632d4306

New changeset 29a5a5b39dd6 by R David Murray in branch 'default':
Mostly-null merge of #18116 backport (updated NEWS entry).
http://hg.python.org/cpython/rev/29a5a5b39dd6

--

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread R. David Murray

R. David Murray added the comment:

Having buffering doesn't make the stream seekable.  So the question is, is the 
*design* of the IO module that '+' requires a seekable stream the best 
behavior, or can that constraint be relaxed?  You have to keep in mind that the 
IO module is a bunch of building blocks, which are plugged together 
automatically for the most common scenarios.  The goal is a portable, 
consistent IO system, not one that completely mimics unix/C IO primitives.

--

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Having buffering doesn't make the stream seekable.  So the question
 is, is the *design* of the IO module that '+' requires a seekable
 stream the best behavior, or can that constraint be relaxed?

A non-seekable read/write stream doesn't really make sense (think about
it).
What you may be thinking about, instead, is a pair of non-seekable
streams, one readable and one writable. There is BufferedRWPair for
that:
http://docs.python.org/dev/library/io.html#io.BufferedRWPair

(granted, BufferedRWPair isn't wired in open(), so you have to do all
the wrapping yourself)

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

Thank you for the comments! I'll update the patch.


BTW is it safe to update Lib/inspect.py:2004 ?

- return cls(parameters, return_annotation=cls.empty)
+ return cls(parameters, return_annotation=f.returns.s or cls.empty)

Looks like the return value is not shown in signature (if it parsed correctly) 
because currently we explicitly pass cls.empty instance, but if we'd pass 
f.returns.s, the return value is shown.

Or it is correct behavior?

--

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



[issue20081] sys.getwindowsversion does nto show some fields

2013-12-27 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola':

On Windows 7:

 v = sys.getwindowsversion()
 v
sys.getwindowsversion(major=6, minor=1, build=7600, platform=2, service_pack='')
 v.service_pack_major
0
 v.service_pack_minor
0
 v.suite_mask
254

Doc states:

 For compatibility with prior versions, only the first 5 elements are 
 retrievable by indexing.

...so I guess that's why service_pack_minor, service_pack_major and suite_mask 
fields are not shown.
Nevertheless I think this is a inconvenience which should be fixed, at least in 
the next major Python version.

--
messages: 207005
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: sys.getwindowsversion does nto show some fields
versions: Python 3.4, Python 3.5

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



[issue20081] sys.getwindowsversion does not show some fields

2013-12-27 Thread Serhiy Storchaka

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


--
title: sys.getwindowsversion does nto show some fields - sys.getwindowsversion 
does not show some fields

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



[issue20059] Inconsistent urlparse/urllib.parse handling of invalid port values?

2013-12-27 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue20050] distutils should check PyPI certs when connecting to it

2013-12-27 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue20078] zipfile - ZipExtFile.read goes into 100% CPU infinite loop on maliciously binary edited zips

2013-12-27 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue20081] sys.getwindowsversion does not show some fields

2013-12-27 Thread R. David Murray

R. David Murray added the comment:

This is essentially a duplicate of item (3) in issue 1820, although I'm not 
entirely clear on what the repr would actually look like.

--
nosy: +r.david.murray

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

So, looks like it works for me and all tests pass.
Here's a new patch.
Feel free to revert Lib/inspect.py:2004-2009 if this is incorrect behavior.

--
Added file: http://bugs.python.org/file33280/20075-2.patch

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



[issue20075] help(open) eats first line

2013-12-27 Thread Larry Hastings

Larry Hastings added the comment:

One of the relevant PEPs (PEP 8?  PEP 7?  the annotations PEP?) states that the 
Python standard library is not permitted to use annotations.  And considering 
that Argument Clinic is an internal-only tool, we could probably justify the 
decision to not allow annotations to creep through.

That said, I think it's harmless, and it might be useful to somebody, so go 
ahead and propagate the annotation from the __text_signature__ into 
inspect.Signature if we get a valid one.  But please create a separate issue 
for it.  (I encourage you to cut-and-paste this text into the description of 
that new issue.)

--

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



[issue1565525] tracebacks eat up memory by holding references to locals and globals when they are not wanted

2013-12-27 Thread A.M. Kuchling

Changes by A.M. Kuchling a...@amk.ca:


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

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



[issue20062] Add section on vim to devguide

2013-12-27 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe added the comment:

I think there should not be any section about any editor in the devguide. It's 
beyond scope, and it risks going stale.

--
nosy: +tshepang

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Dolda2000

Dolda2000 added the comment:

So the question is, is the *design* of the IO module that '+' requires a 
seekable stream the best behavior, or can that constraint be relaxed?

What purpose does that constraint serve? Is there any reason it shouldn't be 
relaxed?

It seems to work quite well without it in Python 2.

--

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



[issue20042] Python Launcher, Windows, fails on scripts w/ non-latin names

2013-12-27 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
title: Python Launcher for Windows fails to invoke scripts with non-latin names 
- Python Launcher, Windows, fails on scripts w/ non-latin names

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



[issue20062] Add section on vim to devguide

2013-12-27 Thread R. David Murray

R. David Murray added the comment:

We have pointers to external resources all over the docs.  Yes, they go stale 
sometimes, and when somebody notices, we update them.  What do you use for 
development is a common topic of discussion, so I don't see any reason not to 
include some pointers in the devguide.  (Not tutorials, just pointers to 
resources.)

--

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread R. David Murray

R. David Murray added the comment:

Antoine already answered that question: it does not make sense to have a single 
stream that is open for *update* if it is not seekable.  The fact C conflates 
update with both read and write can be seen as a design bug in C :)
 
The remaining question might be: is there a sensible way (that fits with the 
design of the IO system) to hook BufferedRWPair up to open?

--

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



[issue20077] Format of TypeError differs between comparison and arithmetic operators

2013-12-27 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
components: +Interpreter Core -ctypes
nosy: +ncoghlan
versions: +Python 3.5 -Python 3.3, Python 3.4

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



[issue20077] Format of TypeError differs between comparison and arithmetic operators

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

I created a patch for it, please review

--
keywords: +patch
nosy: +gennad
Added file: http://bugs.python.org/file33281/20077.patch

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

I'm sorry, I'm not sure I caught the idea. So, I need to create an issue with 
description

propagate the annotation from the __text_signature__ into inspect.Signature if 
we get a valid one. ?

--

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



[issue20082] Misbehavior of BufferedRandom.write with raw file in append mode

2013-12-27 Thread Erik Bray

New submission from Erik Bray:

In #18876 I pointed out the following issue:

BufferedWriter/Random doesn't know the raw file was opened with O_APPEND so the 
writes it shows in the buffer differ from what will actually end up in the 
file.  For example:

 f = open('test', 'wb')
 f.write(b'testest')
7
 f.close()
 f = open('test', 'ab+')
 f.tell()
7
 f.write(b'A')
1
 f.seek(0)
0
 f.read()
b'testestA'
 f.seek(0)
0
 f.read(1)
b't'
 f.write(b'B')
1
 f.seek(0)
0
 f.read()
b'tBstestA'
 f.flush()
 f.seek(0)
0
 f.read()
b'testestAB'

In this example, I read 1 byte from the beginning of the file, then write one 
byte.  Because of O_APPEND, the effect of the write() call on the raw file is 
to append, regardless of where BufferedWriter seeks it to first.  But before 
the f.flush() call f.read() just shows what's in the buffer which is not what 
will actually be written to the file.  (Naturally, unbuffered io does not have 
this particular problem.)


Now that #18876 we can test if a file was opened in append mode and correct for 
this.  The attach patch includes a pretty simple solution that manually calls 
buffered_seek at the beginning of bufferedwriter_write if the raw file is in 
append mode.  In doing so it made sense to split buffered_seek into two 
separate functions.

This might be overkill, however.

--
components: IO
files: buffered-append-1.patch
keywords: patch
messages: 207015
nosy: erik.bray
priority: normal
severity: normal
status: open
title: Misbehavior of BufferedRandom.write with raw file in append mode
type: behavior
Added file: http://bugs.python.org/file33282/buffered-append-1.patch

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



[issue20062] Add section on vim to devguide

2013-12-27 Thread Ezio Melotti

Ezio Melotti added the comment:

I don't think the devguide is a good place for this unless some editors support 
features that are particularly interesting for CPython development (e.g. 
something to check refleaks).
If the features are generic enough that any Python programmer would find them 
interesting, something could be said in the Python FAQs [0] or the wiki [1].  
The FAQs already mention this briefly and have a link to the wiki.

[0]: http://docs.python.org/3/faq/general.html
[1]: https://wiki.python.org/moin/PythonEditors

--
nosy: +pitrou

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



[issue20083] smtplib: support for IDN (international domain names)

2013-12-27 Thread Freek Dijkstra

New submission from Freek Dijkstra:

smtplib has limited support for non-ASCII domain names in the From to To mail 
address. It only works for punycode-encoded domain names, submitted as unicode 
string (e.g. server.rcpt(uu...@xn--e1afmkfd.ru).

The following two calls fail:

server.rcpt(uuser@пример.ru):
  File smtplib.py, line 332, in send
s = s.encode(ascii)
UnicodeEncodeError: 'ascii' codec can't encode character '\u03c0' in position 
19: ordinal not in range(128)
http://hg.python.org/cpython/file/3.3/Lib/smtplib.py#l332

server.rcpt(bu...@xn--e1afmkfd.ru):
  File email/_parseaddr.py, line 236, in gotonext
if self.field[self.pos] in self.LWS + '\n\r':
TypeError: 'in string' requires string as left operand, not int
http://hg.python.org/cpython/file/3.3/Lib/email/_parseaddr.py#l236

There are three ways to solve this (from trivial to complex):
* Make it clear in the documentation what type of input is expected.
* Accept punycode-encoded domain names in email addresses, either in string or 
binary format.
* Accept Unicode-encoded domain names, and do the punycode encoding in the 
smtplib if required.

See also 

References:
https://tools.ietf.org/html/rfc5891: Internationalized Domain Names in 
Applications (IDNA): Protocol

--
components: Library (Lib)
messages: 207017
nosy: macfreek
priority: normal
severity: normal
status: open
title: smtplib: support for IDN (international domain names)
type: enhancement

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



[issue20084] smtplib: support for UTF-8 encoded headers (SMTPUTF8)

2013-12-27 Thread Freek Dijkstra

New submission from Freek Dijkstra:

smtplib has no support for non-ASCII user names in the From to To mail address.

The following two calls fail:

server.rcpt(uόνομα@example.com):
  File smtplib.py, line 332, in send
s = s.encode(ascii)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: 
ordinal not in range(128)
http://hg.python.org/cpython/file/3.3/Lib/smtplib.py#l332

server.rcpt(b'\xcf\x8c\xce\xbd\xce\xbf\xce\xbc\xce\x...@example.com'):
  File email/_parseaddr.py, line 236, in gotonext
if self.field[self.pos] in self.LWS + '\n\r':
TypeError: 'in string' requires string as left operand, not int
http://hg.python.org/cpython/file/3.3/Lib/email/_parseaddr.py#l236

There are two ways to solve this:
* Allow users of smptlib to support internationalised email by passing already 
encoded headers and email addresses. The users is responsible for the encoding 
and setting the SMTPUTF8 ESMTP option.
* Accept Unicode-encoded email addresses, and convert that to UTF-8 in the 
library. smtplib is responsible for the encoding and setting the SMTPUTF8 ESMTP 
option.

References:
https://tools.ietf.org/html/rfc6531: SMTP Extension for Internationalized Email

See also Issue20083, which deals with international domain names in email 
addresses (the part behind the @). This issue deals with the part before the 
@.

Note that this is different from RFC 2047, which merely allows non-ASCII 
encoding in text values in the headers (such as the name of a recipient or the 
mail subject).

--
components: Library (Lib)
messages: 207018
nosy: macfreek
priority: normal
severity: normal
status: open
title: smtplib: support for UTF-8 encoded headers (SMTPUTF8)
type: enhancement

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



[issue20083] smtplib: support for IDN (international domain names)

2013-12-27 Thread Freek Dijkstra

Freek Dijkstra added the comment:

This issue deals with international domain names in email addresses (the part 
behind the @). See issue 20084 for the issue that deals with the part before 
the @.

--

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



[issue4492] httplib code thinks it closes connection, but does not

2013-12-27 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue7464] circular reference in HTTPResponse by urllib2

2013-12-27 Thread Martin Panter

Martin Panter added the comment:

Sounds like urlopen() is relying on garbage collection to close the socket and 
connection. Maybe it would be better to explicitly close the socket, even if 
you do eliminate all the garbage reference cycles.

My test code for Issue 19524 might be useful here. It verifies close() has been 
called on the HTTP socket.

--
nosy: +vadmium

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



[issue20085] Python2.7, wxPython and IDLE 2.7

2013-12-27 Thread stubz

New submission from stubz:

I new to this so I have no idea what's going on ...
I'm using Mint 16 Cinnamon and apparently Python 2.7+ 3.3 are installed
I started puttering with wxPython 2.8 and I have issues ...

I started a tutorial, saved some work.py and got things to run, I guess ...

When I try to open and edit a work.py file I get a blank window ... ?

I also lose my number pad, auto indents and can't close that blank window, I 
basically have to show down the computer to get it to go away ...

I don't know if this is Mint, Python, IDLE or me, but it's annoying ...

Can anyone giving me an idea as to what's going on ?

--
messages: 207021
nosy: stubz
priority: normal
severity: normal
status: open
title: Python2.7, wxPython and IDLE 2.7
type: behavior

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



[issue20059] Inconsistent urlparse/urllib.parse handling of invalid port values?

2013-12-27 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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