cx_Oracle 5.1.3

2014-05-26 Thread Anthony Tuininga
What is cx_Oracle?

cx_Oracle is a Python extension module that enables access to Oracle
for Python 2.x and 3.x and conforms to the Python database API 2.0
specifications with a number of enhancements.


Where do I get it?
http://cx-oracle.sourceforge.net



What's new?

http://cx-oracle.readthedocs.org/en/latest/releasenotes.html
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


PyGObject 3.12.2 Released

2014-05-26 Thread Simon Feltman
I am pleased to announce version 3.12.2 of the Python bindings for
GObject. This is the third release in the stable 3.12.x series for GNOME 3.12.

Download

The new release is available from ftp.gnome.org:

https://download.gnome.org/sources/pygobject/3.12/pygobject-3.12.2.tar.xz (686K)
sha256sum: 7e7a3d349acf5bb4b68f8539a42e67958840a67cd4f0341ee9aa49189af2a522

What's new in PyGObject 3.12.2
=
- PEP8 fixes
- Python 3.4 make check fixes

About PyGObject
===
GObject is a object system used by GTK+, GStreamer and other libraries.

PyGObject provides a convenient wrapper for use in Python programs when
accessing GObject libraries.

Like the GObject library itself PyGObject is licensed under the GNU
LGPL, so is suitable for use in both free software and proprietary
applications. It is already in use in many applications ranging from
small single purpose scripts up to large full featured applications.

PyGObject now dynamically accesses any GObject libraries that uses
GObject Introspection. It replaces the need for separate modules such as
PyGTK, GIO and python-gnome to build a full GNOME 3.0 application. Once
new functionality is added to gobject library it is instantly available
as a Python API without the need for intermediate Python glue.
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


PyGObject 3.13.2 Released

2014-05-26 Thread Simon Feltman
I am pleased to announce version 3.13.2 of the Python bindings for
GObject. This is the third alpha release of the 3.13.x series which will result
in a stable GNOME 3.14 release.

This release fixes a many long standing issues and hits a milestone in our
testing of having over 1,000 unit tests.

Download

The new release is available from ftp.gnome.org:

https://download.gnome.org/sources/pygobject/3.13/pygobject-3.13.2.tar.xz (693K)
sha256sum: 69eb8b642463ca26644a64019ed539c5185ed2abd06600dfc83e793cd028a8de

What's new in PyGObject 3.13.2
=
- Unification of GLib.GError and GLib.Error. GLib.Error should be used for any
  exception handling while GLib.GError is a compatibility alias.
  (Simon Feltman) (#712519)
- New API gi.require_foreign() for ensuring cairo marshalling is supported.
  (Simon Feltman) (#707735)
- Automatic marshalling of cairo objects from non-introspected signal arguments.
  (Simon Feltman) (#694604)
- GTypeClass methods are now directly available on Python GObject classes.
  This allows calling previously un-available methods like:
  Gtk.Widget.list_child_properties (Johan Dahlin) (#685218)
- Gtk.Container.child_get_property and Gtk.Widget.style_get_property now return
  Python native values and the pass-by-reference value argument is optional.
- Add Gtk.Container.child_get and child_set for working with multiple child
  properties (Simon Feltman) (#685076)
- Python 3.4 make check fixes
- PEP8 fixes

About PyGObject
===
GObject is a object system used by GTK+, GStreamer and other libraries.

PyGObject provides a convenient wrapper for use in Python programs when
accessing GObject libraries.

Like the GObject library itself PyGObject is licensed under the GNU
LGPL, so is suitable for use in both free software and proprietary
applications. It is already in use in many applications ranging from
small single purpose scripts up to large full featured applications.

PyGObject now dynamically accesses any GObject libraries that uses
GObject Introspection. It replaces the need for separate modules such as
PyGTK, GIO and python-gnome to build a full GNOME 3.0 application. Once
new functionality is added to gobject library it is instantly available
as a Python API without the need for intermediate Python glue.
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Standard Delay Format (SDF) Parsing

2014-05-26 Thread garg . pankaj83
Hi Steven,

did you get the module to parse the sdf file?

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


Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-26 Thread Nagy László Zsolt


2014.05.25. 23:49 keltezéssel, Terry Reedy írta:

On 5/25/2014 1:40 PM, Nagy László Zsolt wrote:

  import win32service
Traceback (most recent call last):
   File stdin, line 1, in module
ImportError: DLL load failed: The specified module could not be found

I have no problem loading the same module with Python 2.7.


So the above is with ???

Is with 3.4 amd64



Strange thing is that win32serviceutil.py is part of the pywin32
distribution, so I guess I should be able to import it, right?


Make sure you have a pywin32 that matches ???. Matching includes 
python version and bitness.
It does. Installed Python 3.4.1 (64-bit) and pywin32-219 (64-bit) taken 
from here:


http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32


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


Re: Make Python Compilable, convert to Python source to Go

2014-05-26 Thread Devin Jeanpierre
On Sun, May 25, 2014 at 3:24 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 25/05/2014 09:17, bookaa bookaa wrote:

 Maybe I will work on Python 3 later.


 That's good to know, it'll save me wasting my time looking at it now.

This seems like an unnecessarily harsh way of putting it, Mark. Could
you be less dismissive of the hard work others put into improving the
Python world?

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


Re: Standard Delay Format (SDF) Parsing

2014-05-26 Thread moogyd
On Monday, 26 May 2014 08:15:53 UTC+2, garg.p...@gmail.com  wrote:
 Hi Steven,
 
 
 
 did you get the module to parse the sdf file?
 
 
 
 regards,
 
 pankaj

Unfortunately not. 
I actually can't remember why I wanted/needed this. I guess that it wasn't that 
important since I didn't actually do any parsing.
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Make Python Compilable, convert to Python source to Go

2014-05-26 Thread Stefan Behnel
Ben Finney, 26.05.2014 05:20:
 bookaa bookaa writes:
 Generally, people consider Python as a script language.
 It has high development efficiency
 but run too slowly
 
 Which Python implementation are you talking about? Run time is not a
 property of the language. It is a property of the language
 implementation.

That, plus the fact that talking about a language or language
implementation being slow actually makes no sense at all without
referring to a specific piece of code or at least an application scenario
in which it is (provably) slow when compared to something (specific) else.

Stefan


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


Hello and sorry for disturbing !

2014-05-26 Thread Radu Ioan Barbos
Greetings from Romania,sorry 
for my english,i just wanted to ask you if i need any other 
software/program beside the one software from the next 
pagehttps://www.python.org/downloads/ or is it enough the software on that page 
, download and install it ? 
This question goes for both windows 7  ubuntu (ubuntu). Il be 
waiting for your answer , thank you verry much !

Barbos RauTimisoara,Romania !
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: compiled cx_freeze

2014-05-26 Thread Nagy László Zsolt



Let  Christoph know, he is very responsive and extremely helpful.
He did help. The new version is available on his site and it works. 
Thank you.

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


Re: Make Python Compilable, convert to Python source to Go

2014-05-26 Thread Mark Lawrence

On 26/05/2014 07:31, Devin Jeanpierre wrote:

On Sun, May 25, 2014 at 3:24 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:

On 25/05/2014 09:17, bookaa bookaa wrote:


Maybe I will work on Python 3 later.



That's good to know, it'll save me wasting my time looking at it now.


This seems like an unnecessarily harsh way of putting it, Mark. Could
you be less dismissive of the hard work others put into improving the
Python world?

-- Devin



Like Python 2.8?

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


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: Hello and sorry for disturbing !

2014-05-26 Thread Rustom Mody
On Monday, May 26, 2014 2:57:54 PM UTC+5:30, Radu Ioan Barbos wrote:
 Greetings from Romania,sorry 
 for my english,i just wanted to ask you if i need any other 
 software/program beside the one software from the next page 
 https://www.python.org/downloads/
  or is it enough the software on that page , download and install it ? 
 This question goes for both windows 7  ubuntu (ubuntu). Il be 
 waiting for your answer , thank you verry much !
 
 Barbos RauTimisoara,Romania !

Hello and welcome!

For ubuntu you should need nothing for python.
In other words python should run on a basic ubuntu installation.
From the shell just type python and the interpreter should start.

For more specialized work there are dozens (maybe hundreds?) of packages
in the apt repos.  Better to use that rather than trying to directly
download.

For windows, I guess thats the link you posted.
However I will let someone more knowledgeable give the details
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello and sorry for disturbing !

2014-05-26 Thread Wolfgang Maier

On 26.05.2014 13:27, Rustom Mody wrote:

On Monday, May 26, 2014 2:57:54 PM UTC+5:30, Radu Ioan Barbos wrote:

Greetings from Romania,sorry
for my english,i just wanted to ask you if i need any other
software/program beside the one software from the next page 
https://www.python.org/downloads/
  or is it enough the software on that page , download and install it ?
This question goes for both windows 7  ubuntu (ubuntu). Il be
waiting for your answer , thank you verry much !

Barbos RauTimisoara,Romania !


Hello and welcome!

For ubuntu you should need nothing for python.
In other words python should run on a basic ubuntu installation.
 From the shell just type python and the interpreter should start.



If you're planning to use Python3, which is arguably (see various other 
threads on this list) a good idea for a beginner, make sure you upgrade 
to the latest Ubuntu LTS version (14.04 Trusty Tahr). This comes with 
Python 3.4 available from the shell as python3.




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


Re: Build tools, and Python 3 dependencies (was: How keep Python 3 moving forward)

2014-05-26 Thread Roy Smith
In article mailman.10329.1401074189.18130.python-l...@python.org,
 Ben Finney b...@benfinney.id.au wrote:

 Roy Smith r...@panix.com writes:
 
  Stefan Behnel stefan...@behnel.de wrote:
 
   And I don't really see why you would consider fabric a dependency
   that keeps you from switching to Py3. In many cases, you can just
   keep running it in Py2 as you did before.
 
  In theory, that's possible. In practice, it would mean having to
  maintain two different versions of Python
 
 Why would using Fabric – a build tool – require you to “maintain two
 different versions of Python”? You only need to maintain the build
 scripts, not Python itself.

Because to run these tools, we need have both versions installed on 
every machine.  So, we don't need to maintain Python in the sense of 
building it from source, but we do need to have our deployment scripts 
install it everyplace it's needed (or, at least, make sure it's 
installed as part of some base deployment package)

  and test everything against both.
 
 That makes even less sense. The build system runs under whatever version
 of Python it needs, and your code runs under whatever version of Python
 you like. The two don't affect each other at run time, and don't affect
 each other's testing dependencies.

The are tightly integrated, and share code.

 At least one of us seems to be misunderstanding what is required.

Yes :-)

When you start working with large systems, reducing complexity becomes 
important.  Every time you add a component, it comes with its own set of 
dependencies and constraints.  Those things come back to bite you when 
you least expect it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-26 Thread Albert-Jan Roskam
 Original Message -
 From: Terry Reedy tjre...@udel.edu
 To: python-list@python.org
 Cc: 
 Sent: Sunday, May 25, 2014 11:49 PM
 Subject: Re: win32serviceutil: ImportError: DLL load failed: The specified 
 module could not be found
 
 On 5/25/2014 1:40 PM, Nagy László Zsolt wrote:
    import win32service
  Traceback (most recent call last):
     File stdin, line 1, in module
  ImportError: DLL load failed: The specified module could not be found
 
  I have no problem loading the same module with Python 2.7.
 
 So the above is with ???
 
  Strange thing is that win32serviceutil.py is part of the pywin32
  distribution, so I guess I should be able to import it, right?
 
 Make sure you have a pywin32 that matches ???. Matching includes python 
 version and bitness.

In addition, c:\python27\DLLs should also be on your %PATH%:
setx PATH %PATH%;c:\python27\DLLs 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-26 Thread Nagy László Zsolt



  Strange thing is that win32serviceutil.py is part of the pywin32
  distribution, so I guess I should be able to import it, right?

Make sure you have a pywin32 that matches ???. Matching includes python
version and bitness.

In addition, c:\python27\DLLs should also be on your %PATH%:
setx PATH %PATH%;c:\python27\DLLs
Just curious: what if I don't have python2.7 installed at all? How on 
earth python3.4 + pywin32 requires DLL files from python2.7 ?


BTW it did not help. Here is my path:

Path=C:\Python34\;C:\Python34\Scripts;C:\Program Files (x86)\NVIDIA 
Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program 
Files\SlikSvn\bin;C:\texlive\2013\bin\win32;c:\Python34\DLLs;c:\Python27\DLLs


I have both Python27 and Python34 installed.

Python 3.4: import win32service still throws ImportError: DLL load 
failed.

Python 2.7: import win32service succeeds

Build information:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 
bit (AMD64)] on win32


It is the official latest. pywin32 is also the latest (build 219).


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


Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-26 Thread Tim Golden

On 26/05/2014 14:24, Nagy László Zsolt wrote:



  Strange thing is that win32serviceutil.py is part of the pywin32
  distribution, so I guess I should be able to import it, right?

Make sure you have a pywin32 that matches ???. Matching includes python
version and bitness.

In addition, c:\python27\DLLs should also be on your %PATH%:
setx PATH %PATH%;c:\python27\DLLs

Just curious: what if I don't have python2.7 installed at all? How on
earth python3.4 + pywin32 requires DLL files from python2.7 ?

BTW it did not help. Here is my path:

Path=C:\Python34\;C:\Python34\Scripts;C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\SlikSvn\bin;C:\texlive\2013\bin\win32;c:\Python34\DLLs;c:\Python27\DLLs


I have both Python27 and Python34 installed.

Python 3.4: import win32service still throws ImportError: DLL load
failed.
Python 2.7: import win32service succeeds

Build information:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64
bit (AMD64)] on win32

It is the official latest. pywin32 is also the latest (build 219).


Nagy -- could you post to the python-win32 list? There's nothing wrong 
with putting it out here, but I don't know if the pywin32 guys hang out 
here, and I know they definitely do there. (Which is also lower volume).


I'm not seeing any changes to the win32service code, but a missing DLL 
error is almost always about some combination of permissions / UAC on 
install. Adding anything to your PATH is unlikely to help (unless you 
have a truly outlandish PATH).


I'll try to reproduce later if I can but I don't have time right now.

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


Re: Hello and sorry for disturbing !

2014-05-26 Thread Mark Lawrence

On 26/05/2014 10:27, Radu Ioan Barbos wrote:

Greetings from Romania,sorry for my english,i just wanted to ask you if
i need any other software/program beside the one software from the next
pagehttps://www.python.org/downloads/
https://www.python.org/downloads/ or is it enough the software on that
page , download and install it ? This question goes for both windows 7 
ubuntu (ubuntu). Il be waiting for your answer , thank you verry much !
Barbos Rau
Timisoara,Romania !



As you've had answers to your questions I'll just say please don't 
apologise for your English, it's an extremely difficult language to 
learn.  Thank you.


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


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Verify JSON Data

2014-05-26 Thread gaurangnshah
Hi Guys, 

Would someone let me know how to verify JSON data in python. There are so many 
modules available to verify XML file, however i didn't find any good module to 
verify JSON Data. 

After searching on the internet i came across JSON module, however it only 
coverts the JSON data to python. it's good, however the problem comes when JSON 
response is very large.  

Is there any module through which i can verify JSON file like DOM or Object 
oriented way. ( i.e. data.key)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-26 Thread cjgohlke
On Monday, May 26, 2014 6:32:19 AM UTC-7, Tim Golden wrote:
 On 26/05/2014 14:24, Nagy L�szl� Zsolt wrote:
 
 
 
Strange thing is that win32serviceutil.py is part of the pywin32
 
distribution, so I guess I should be able to import it, right?
 
  Make sure you have a pywin32 that matches ???. Matching includes python
 
  version and bitness.
 
  In addition, c:\python27\DLLs should also be on your %PATH%:
 
  setx PATH %PATH%;c:\python27\DLLs
 
  Just curious: what if I don't have python2.7 installed at all? How on
 
  earth python3.4 + pywin32 requires DLL files from python2.7 ?
 
 
 
  BTW it did not help. Here is my path:
 
 
 
  Path=C:\Python34\;C:\Python34\Scripts;C:\Program Files (x86)\NVIDIA
 
  Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
 
  Files\SlikSvn\bin;C:\texlive\2013\bin\win32;c:\Python34\DLLs;c:\Python27\DLLs
 
 
 
 
 
  I have both Python27 and Python34 installed.
 
 
 
  Python 3.4: import win32service still throws ImportError: DLL load
 
  failed.
 
  Python 2.7: import win32service succeeds
 
 
 
  Build information:
 
 
 
  Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64
 
  bit (AMD64)] on win32
 
 
 
  It is the official latest. pywin32 is also the latest (build 219).
 
 
 
 Nagy -- could you post to the python-win32 list? There's nothing wrong 
 
 with putting it out here, but I don't know if the pywin32 guys hang out 
 
 here, and I know they definitely do there. (Which is also lower volume).
 
 
 
 I'm not seeing any changes to the win32service code, but a missing DLL 
 
 error is almost always about some combination of permissions / UAC on 
 
 install. Adding anything to your PATH is unlikely to help (unless you 
 
 have a truly outlandish PATH).
 
 
 
 I'll try to reproduce later if I can but I don't have time right now.
 
 
 
 TJG

Python 3.4 does not run any bdist_wininst postinstall scripts. Try to run 
`C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install` 
manually from an elevated command prompt.

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


Re: confused about the different built-in functions in Python

2014-05-26 Thread Deb Wyatt
snip
 
 On 5/25/14 7:55 PM, Deb Wyatt wrote:
 I am confused about how various built-in functions are called.  Some are
 called with dot notation
 
snip
 How do you know/remember which way to call them?
 
 TIA,
 Deb in WA, USA
 
 It can be confusing.  Generally, built-in functions (like sum, len, etc)
 are used when the operation could apply to many different types.  For
 example, sum() can be used with any iterable that produces addable
 things.
 
 Operations that are defined only for a single type (like .isalpha as a
 string operation) are usually defined as methods on the type.
 
 This is not a black/white distinction, I'm sure there are interesting
 counter-examples.  But this is the general principle.
 
 --
 Ned Batchelder, http://nedbatchelder.com
 
 --
 https://mail.python.org/mailman/listinfo/python-list

Thank you for answering.  I meant to send this to the tutor list, but messed 
up.  So, I guess there isn't a magic answer to this one, and I'll learn as I 
learn the language.  Have a great day.

Deb in WA, USA


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Check it out at http://www.inbox.com/earth


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


Re: Verify JSON Data

2014-05-26 Thread Roy Smith
In article e26d3f14-ac97-4abd-bdfc-699d9ed21...@googlegroups.com,
 gaurangns...@gmail.com wrote:

 Hi Guys, 
 
 Would someone let me know how to verify JSON data in python. There are so 
 many modules available to verify XML file, however i didn't find any good 
 module to verify JSON Data. 

Python comes with a built-in json module.  Just use json.load() or 
json.loads() to parse your JSON data.  The first call reads from a 
string, the second on from a file, but in all other ways, they're 
identical.

There are a bunch of third-party modules (ujson, etc) which are faster, 
but fundamentally, they're all the same.

If I understand you correctly, you're reading a JSON document which is 
so large that if you store the converted data as a Python object, you 
run out of memory?  If that's the case, I'm not sure if there's a good 
pure Python solution.  I don't know of any json modules which parse, but 
don't store, the data.

Depending on what operating system you're on, there may be a 
command-line utility which parse JSON.  For example, on Ubuntu linux, 
there's json_xs.  Perhaps shell out to that, use the -t null output 
format, redirect the output to /dev/null, and see what exit status you 
get:

# Good JSON
$ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
0

# Bad JSON
$ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
255

Wrap this up in a subprocess.check_output() call, and you're done.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Verify JSON Data

2014-05-26 Thread Burak Arslan

On 26/05/14 16:26, gaurangns...@gmail.com wrote:

Hi Guys,

Would someone let me know how to verify JSON data in python. There are so many 
modules available to verify XML file, however i didn't find any good module to 
verify JSON Data.



Hi,

Spyne re-implements (a useful subset of) Xml Schema validation so that 
it can be applied to other document formats like json. It's 'soft' 
validation in Spyne's terms.


http://spyne.io

Disclosure: I'm the author of Spyne and starting to feel like I'm 
talking a little bit too much about my project on this list :)


Hth,
Burak

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


Re: Verify JSON Data

2014-05-26 Thread Gene Heskett
On Monday 26 May 2014 11:19:53 Roy Smith did opine
And Gene did reply:
 In article e26d3f14-ac97-4abd-bdfc-699d9ed21...@googlegroups.com,
 
  gaurangns...@gmail.com wrote:
  Hi Guys,
  
  Would someone let me know how to verify JSON data in python. There
  are so many modules available to verify XML file, however i didn't
  find any good module to verify JSON Data.
 
 Python comes with a built-in json module.  Just use json.load() or
 json.loads() to parse your JSON data.  The first call reads from a
 string, the second on from a file, but in all other ways, they're
 identical.
 
 There are a bunch of third-party modules (ujson, etc) which are faster,
 but fundamentally, they're all the same.
 
 If I understand you correctly, you're reading a JSON document which is
 so large that if you store the converted data as a Python object, you
 run out of memory?  If that's the case, I'm not sure if there's a good
 pure Python solution.  I don't know of any json modules which parse,
 but don't store, the data.
 
 Depending on what operating system you're on, there may be a
 command-line utility which parse JSON.  For example, on Ubuntu linux,
 there's json_xs.  Perhaps shell out to that, use the -t null output
 format, redirect the output to /dev/null, and see what exit status you
 get:
 
 # Good JSON
 $ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
 0
 
 # Bad JSON
 $ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
 255
 
 Wrap this up in a subprocess.check_output() call, and you're done.

Just for SG, and without checking the version numbers of anything, this 
may not be all that bulletproof a test:

gene@coyote:~$ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
127
gene@coyote:~$ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
127

Old, buntu 10.04.4 LTS system, all up to date security patches wise.  
kernal 3.13.9, PAE on a quad core phenom.

Interesting result.  Source of error? DamnedifIknow.

Cheers, Gene Heskett
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
Genes Web page http://geneslinuxbox.net:6309/gene
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Verify JSON Data

2014-05-26 Thread Denis McMahon
On Mon, 26 May 2014 07:26:20 -0700, gaurangnshah wrote:

 Is there any module through which i can verify JSON file like DOM or
 Object oriented way. ( i.e. data.key)

Where is the json data coming from? What do you mean by verify?

https://docs.python.org/2/library/json.html#encoders-and-decoders

explains how json object strings get decoded to python data types. A json 
object string should at the highest level be either an object or an 
array, although the python decoder can also handle strings, numbers and a 
few special values.

Are you trying to check that the json string is valid json code (ie json 
lint) or are you trying to check that it meets some specific structure, 
in which case the only way to verify it is to decode it and check the 
structure.

Note that not all valid python structures can be successfully converted 
to json objects, for example a python dictionary can have tuples as keys, 
but a json object can not have an array as an attribute name. For example:

d = { (1,2,3):'one',('a','b','c'):'two' }
print d
print json.JSONEncoder().encode( d )

Gives a TypeError in the json code keys must be a string

If you have a debian based linux distro, you can get jsonlint with:

sudo apt-get install python-demjson

which provides a command line json syntax checker and formatter. 
Otherwise, google json lint, there are several web based tools that seem 
to be able to do something similar.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Verify JSON Data

2014-05-26 Thread Chris Angelico
On Tue, May 27, 2014 at 1:37 AM, Gene Heskett ghesk...@shentel.net wrote:
 Just for SG, and without checking the version numbers of anything, this
 may not be all that bulletproof a test:

 gene@coyote:~$ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
 127
 gene@coyote:~$ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
 127

 Old, buntu 10.04.4 LTS system, all up to date security patches wise.
 kernal 3.13.9, PAE on a quad core phenom.

 Interesting result.  Source of error? DamnedifIknow.


Return value 127 might well mean that json_xs isn't installed. It's
very difficult for a non-program to tell you whether JSON is valid or
not :) So I'd be checking 'which json_xs' before continuing.

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


Re: Verify JSON Data

2014-05-26 Thread Roy Smith
In article mailman.10347.1401119046.18130.python-l...@python.org,
 Gene Heskett ghesk...@shentel.net wrote:

  $ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
 0

  $ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
 255


 gene@coyote:~$ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
 127
 gene@coyote:~$ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
 127

I don't see what the problem is.  On average, we got the same result :-)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Verify JSON Data

2014-05-26 Thread Chris Angelico
On Tue, May 27, 2014 at 1:55 AM, Roy Smith r...@panix.com wrote:
 In article mailman.10347.1401119046.18130.python-l...@python.org,
  Gene Heskett ghesk...@shentel.net wrote:

  $ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
 0

  $ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
 255


 gene@coyote:~$ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
 127
 gene@coyote:~$ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
 127

 I don't see what the problem is.  On average, we got the same result :-)

Ahh but if you were using Python 3, those averages would be 127.5 each.

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


Re: Verify JSON Data

2014-05-26 Thread Chris Angelico
On Tue, May 27, 2014 at 1:19 AM, Roy Smith r...@panix.com wrote:
 Python comes with a built-in json module.  Just use json.load() or
 json.loads() to parse your JSON data.  The first call reads from a
 string, the second on from a file, but in all other ways, they're
 identical.

Minor nit-pick: they're the other way around - load() reads from a
file and loads() reads from a string. I wouldn't bother commenting,
except that load() could plausibly mean load from string, and 'str'
object has no attribute 'read' might be a bit of a surprise else :)

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


Re: Verify JSON Data

2014-05-26 Thread Gene Heskett
On Monday 26 May 2014 11:55:29 Roy Smith did opine
And Gene did reply:
 In article mailman.10347.1401119046.18130.python-l...@python.org,
 
  Gene Heskett ghesk...@shentel.net wrote:
   $ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo $?
  
  0
  
   $ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo $?
  
  255
  
  
  gene@coyote:~$ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo
  $? 127
  gene@coyote:~$ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo
  $? 127
 
 I don't see what the problem is.  On average, we got the same result
 :-)

If I was still smoking Roy, I'd ask for a hit on whatever you are having. 
:)

Cheers, Gene Heskett
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
Genes Web page http://geneslinuxbox.net:6309/gene
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Verify JSON Data

2014-05-26 Thread Gene Heskett
On Monday 26 May 2014 11:58:06 Chris Angelico did opine
And Gene did reply:
 On Tue, May 27, 2014 at 1:37 AM, Gene Heskett ghesk...@shentel.net 
wrote:
  Just for SG, and without checking the version numbers of anything,
  this may not be all that bulletproof a test:
  
  gene@coyote:~$ echo '[1, 2, 3]' | json_xs -t null 2/dev/null; echo
  $? 127
  gene@coyote:~$ echo '[1; 2, 3]' | json_xs -t null 2/dev/null; echo
  $? 127
  
  Old, buntu 10.04.4 LTS system, all up to date security patches wise.
  kernal 3.13.9, PAE on a quad core phenom.
  
  Interesting result.  Source of error? DamnedifIknow.
 
 Return value 127 might well mean that json_xs isn't installed. It's
 very difficult for a non-program to tell you whether JSON is valid or
 not :) So I'd be checking 'which json_xs' before continuing.
 
 ChrisA

And locate comes back empty. So much for that. ;-)

Cheers, Gene Heskett
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
Genes Web page http://geneslinuxbox.net:6309/gene
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python is horribly slow compared to bash!!

2014-05-26 Thread Johannes Bauer
On 22.05.2014 15:43, wxjmfa...@gmail.com wrote:

 I can take the same application and replace 'z' by ..., and
 ... No, I do not win :-( . Python fails.

That's nothing. I can make an application a TOUSAND times slower by
changing the constant 1 to a 2. Python is such utter garbage!

import time

def myfunction(constant):
if constant == 1:
time.sleep(1)
else:
time.sleep(1000)

constant = 1
myfunction(constant)

Now let's all code Itanium assembler, yes?

Cheers,
Johannes

-- 
 Wo hattest Du das Beben nochmal GENAU vorhergesagt?
 Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
 - Karl Kaos über Rüdiger Thomas in dsa hidbv3$om2$1...@speranza.aioe.org
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Send commands to USB device in Python

2014-05-26 Thread andre . miras
Hi,

I saw your thread on SourceFourge 
(http://sourceforge.net/p/pyusb/mailman/message/31969943/), but I don't have an 
account.
I also have MTI RU-824 reader. I sniffed the USB communication in the Windows 
demo program and I saw that the header should be written backward.
So rather than:
HEADER = bytearray(MTIC)
try:
HEADER = bytearray(MTIC[::-1])
I tested it and it works.



On Tuesday, 11 February 2014 06:55:03 UTC+1, Setia Budi  wrote:
 Hi fellows,
 
 I am facing difficulties in order to send USB commands to an RFID reader.
 
 This is the command reference of the device: 
 https://github.com/mti-rfid/RFID_Explorer
 
 
 
 I am working with the MTI RU-824 model.
 
 
 
 The manufacturer of the device only provide a driver for Windows (using 
 .Net), but we need to run the device on Linux. That's why I need to write few 
 lines of code in Python as a new driver.
 
 
 
 I am using PyUSB for accessing the device, and this is few lines of my code:
 
 
 
 
 
 
 
 import usb.core
 
 import usb.util
 
 import sys
 
 
 
 VENDOR_ID = 0x24e9
 
 PRODUCT_ID = 0x0824
 
 
 
 device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
 
 
 
 if device is None:
 
 sys.exit(Could not find Id System Barcode Reader.)
 
 else:
 
 print 'Device detected'
 
 
 
 device.set_configuration()
 
 
 
 cfg = device.get_active_configuration()
 
 interface_number = cfg[(0, 0)].bInterfaceNumber
 
 alternate_setting = usb.control.get_interface(device, interface_number)
 
 usb_interface = usb.util.find_descriptor(
 
 cfg, bInterfaceNumber=interface_number,
 
 bAlternateSetting=alternate_setting
 
 )
 
 
 
 endpoint_out = usb.util.find_descriptor(
 
 usb_interface,
 
 # match the first OUT endpoint
 
 custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == 
 usb.util.ENDPOINT_OUT
 
 )
 
 
 
 endpoint_in = usb.util.find_descriptor(
 
 usb_interface,
 
 # match the first IN endpoint
 
 custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == 
 usb.util.ENDPOINT_IN
 
 )
 
 
 
 endpoint_out.write('0x01')
 
 print endpoint_in.read(len('0x01'), 1000)
 
 
 
 =
 
 My question is on the last 2 lines.
 
 I am using endpoint_out to send a command and endpoint_in to read data from 
 the reader. Am I correct?
 
 
 
 The problem is, when I run the code, there is an error message like this: 
 
 usb.core.USBError: [Errno 110] Operation timed out
 
 
 
 Anyone can give a clue?
 
 Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Verify JSON Data

2014-05-26 Thread Grant Edwards
On 2014-05-26, gaurangns...@gmail.com gaurangns...@gmail.com wrote:

 Would someone let me know how to verify JSON data in python.

Parse the file into a data structure with whatever parser you like,
then write a program to go thorugh the data structure and verify it.

 There are so many modules available to verify XML file, however i
 didn't find any good module to verify JSON Data.

XML has various schema languages which can be used to write a
definition of what is valid and what isn't valid.

There really is anything like that in widespread use for JSON.

 After searching on the internet i came across JSON module, however it
 only coverts the JSON data to python. it's good, however the problem
 comes when JSON response is very large.  

What's the problem?

 Is there any module through which i can verify JSON file like DOM or
 Object oriented way. ( i.e. data.key)

I don't know what you're asking.

-- 
Grant Edwards   grant.b.edwardsYow! Actually, what I'd
  at   like is a little toy
  gmail.comspaceship!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: confused about the different built-in functions in Python

2014-05-26 Thread Terry Reedy

On 5/26/2014 11:15 AM, Deb Wyatt wrote:

snip


On 5/25/14 7:55 PM, Deb Wyatt wrote:

I am confused about how various built-in functions are called.  Some are
called with dot notation


snip

How do you know/remember which way to call them?



It can be confusing.  Generally, built-in functions (like sum, len, etc)
are used when the operation could apply to many different types.  For
example, sum() can be used with any iterable that produces addable
things.

Operations that are defined only for a single type (like .isalpha as a
string operation) are usually defined as methods on the type.

This is not a black/white distinction, I'm sure there are interesting
counter-examples.  But this is the general principle.


Part of the answer is Python's history. Up to about 2.1, most built-in 
types did not have methods, though I know lists did. Ints and strings 
did not, or chr and ord might have been int.chr() and str.ord(). (The 
current string methods were originally functions in the string module.)



Thank you for answering.  I meant to send this to the tutor list, but messed up.

 So, I guess there isn't a magic answer to this one, and I'll learn
 as I learn the language.  Have a great day.



--
Terry Jan Reedy

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


Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Terry Reedy tjre...@udel.edu:

 Part of the answer is Python's history. Up to about 2.1, most built-in
 types did not have methods, though I know lists did. Ints and strings
 did not, or chr and ord might have been int.chr() and str.ord(). (The
 current string methods were originally functions in the string
 module.)

Ints still aren't quite like regular objects. For example:

x = 500
x.__str__ is x.__str__
   False


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


Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found [SOLVED]

2014-05-26 Thread Nagy László Zsolt



Python 3.4 does not run any bdist_wininst postinstall scripts. Try to run 
`C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install` 
manually from an elevated command prompt.

Christoph
C:\C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py 
-install

Copied pythoncom34.dll to C:\Python34\pythoncom34.dll
Copied pywintypes34.dll to C:\Python34\pywintypes34.dll
You do not have the permissions to install COM objects.
The sample COM objects were not registered.
- Software\Python\PythonCore\3.4\Help[None]=None
- Software\Python\PythonCore\3.4\Help\Pythonwin 
Reference[None]='C:\\Python34\\

Lib\\site-packages\\PyWin32.chm'
Pythonwin has been registered in context menu
Creating directory C:\Python34\Lib\site-packages\win32com\gen_py
Can't install shortcuts - 
'C:\\Users\\Laci\\AppData\\Roaming\\Microsoft\\Windows

\\Start Menu\\Programs\\Python 3.4' is not a folder
The pywin32 extensions were successfully installed.

C:\python
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 
bit (AM

D64)] on win32
Type help, copyright, credits or license for more information.
 import win32service


Thanks!

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


Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found

2014-05-26 Thread Nagy László Zsolt



Python 3.4 does not run any bdist_wininst postinstall scripts. Try to run 
`C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install` 
manually from an elevated command prompt.

Much better when ran as an administrator:

C:\Python\Projects\testC:\Python34\python.exe 
C:\Python34\Scripts\pywin32_postinstall.py -install

Copied pythoncom34.dll to C:\Windows\system32\pythoncom34.dll
Copied pywintypes34.dll to C:\Windows\system32\pywintypes34.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
- Software\Python\PythonCore\3.4\Help[None]=None
- Software\Python\PythonCore\3.4\Help\Pythonwin 
Reference[None]='C:\\Python34\\Lib\\site-packages\\PyWin32.chm'

Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.


I wonder why is a difference between 2.7 and 3.4 in this?
--
https://mail.python.org/mailman/listinfo/python-list


Re: confused about the different built-in functions in Python

2014-05-26 Thread Christian Heimes
On 26.05.2014 21:00, Marko Rauhamaa wrote:
 Terry Reedy tjre...@udel.edu:
 
 Part of the answer is Python's history. Up to about 2.1, most built-in
 types did not have methods, though I know lists did. Ints and strings
 did not, or chr and ord might have been int.chr() and str.ord(). (The
 current string methods were originally functions in the string
 module.)
 
 Ints still aren't quite like regular objects. For example:
 
 x = 500
 x.__str__ is x.__str__
False

Just like every other object:

 class Example(object): pass
...
 e = Example()
 e.__str__ is e.__str__
False

Python creates a new bound method object every time. A bound method
object is a callable object that keeps a strong reference to the
function, class and object. The bound method object adds the object as
first argument to the function (aka 'self').

Christian


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


Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Christian Heimes christ...@python.org:

 Python creates a new bound method object every time. A bound method
 object is a callable object that keeps a strong reference to the
 function, class and object. The bound method object adds the object as
 first argument to the function (aka 'self').

I stand corrected. I had thought the trampoline (bound method object)
was created once and for all.


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


Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Marko Rauhamaa ma...@pacujo.net:

 Christian Heimes christ...@python.org:

 Python creates a new bound method object every time. A bound method
 object is a callable object that keeps a strong reference to the
 function, class and object. The bound method object adds the object as
 first argument to the function (aka 'self').

 I stand corrected. I had thought the trampoline (bound method
 object) was created once and for all.

Sure enough. The principle is explicitly specified in URL:
https://docs.python.org/3.2/reference/datamodel.html#index-46.

Thus:

class X:
   ...   def f(self):
   ... print(Hello)
   ... 
x = X()
x.f()
   Hello
def f(): print(Meh)
   ... 
x.f = f
x.f()
   Meh
delattr(x, f)
x.f()
   Hello

IOW, you can override a method with setattr() but you cannot delete a
method with delattr().


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


Re: confused about the different built-in functions in Python

2014-05-26 Thread Gregory Ewing

Marko Rauhamaa wrote:


IOW, you can override a method with setattr() but you cannot delete a
method with delattr().


Actually, you can -- but you need to delete it from
the class, not the instance:

 delattr(X, 'f')
 x.f()
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'X' object has no attribute 'f'

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


Command prompt not shown when running Python script with subprocess on Windows

2014-05-26 Thread ps16thypresenceisfullnessofjoy
I have written a Python script with a wxPython GUI that uses subprocess.Popen 
to open a list of files that the user provides. One of my users would like to 
be able to run a Python script with my application. The Python script he is 
trying to run uses the command line and gets keyboard input from the user 
several times.

The problem is that if the Python script is run on Windows with 
subprocess.Popen, no command prompt is shown (my GUI application is a .pyw 
file). The user's script runs silently but then does not quit because it is 
waiting for input, but there is no way for the input to be given, since there 
is no command prompt visible.

I think this may be related to the fact that I am calling subprocess.Popen with 
shell=True. I tried calling it with shell=False (the default), but then I got 
an error that the file is not a valid Win32 application.

I would appreciate any help with this problem.

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


Re: Make Python Compilable, convert to Python source to Go

2014-05-26 Thread Steven D'Aprano
On Mon, 26 May 2014 12:17:10 +0100, Mark Lawrence wrote:

 On 26/05/2014 07:31, Devin Jeanpierre wrote:
 On Sun, May 25, 2014 at 3:24 AM, Mark Lawrence
 breamore...@yahoo.co.uk wrote:
 On 25/05/2014 09:17, bookaa bookaa wrote:

 Maybe I will work on Python 3 later.


 That's good to know, it'll save me wasting my time looking at it now.

 This seems like an unnecessarily harsh way of putting it, Mark. Could
 you be less dismissive of the hard work others put into improving the
 Python world?

 -- Devin


 Like Python 2.8?

I think you may have drifted into an alternate universe. There is no 
Python 2.8 and nobody has done any hard work on writing it, so I have no 
idea what point you think you are making. (That's the trouble with snappy 
one-line answers to serious questions -- they often make no sense to 
anyone outside of your head.)

The OP has done a lot of hard work at writing a Python 2 to Go translator 
(allegedly -- we haven't actually been shown his project) and assuming it 
works and done what he says it does, that's valuable. Python 2.7 will be 
part of the Python ecosystem until at least 2022. Furthermore, adapting 
an existing Python2 to Go compiler to work with Python3 will be much 
easier than writing one from scratch.


-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: confused about the different built-in functions in Python

2014-05-26 Thread Steven D'Aprano
On Mon, 26 May 2014 23:58:37 +0300, Marko Rauhamaa wrote:

 Marko Rauhamaa ma...@pacujo.net:
 
 Christian Heimes christ...@python.org:

 Python creates a new bound method object every time. A bound method
 object is a callable object that keeps a strong reference to the
 function, class and object. The bound method object adds the object as
 first argument to the function (aka 'self').

 I stand corrected. I had thought the trampoline (bound method object)
 was created once and for all.
 
 Sure enough. The principle is explicitly specified in URL:
 https://docs.python.org/3.2/reference/datamodel.html#index-46.
 
 Thus:
 
 class X:
...   def f(self):
... print(Hello)
...
 x = X()
 x.f()
Hello
 def f(): print(Meh)
...
 x.f = f
 x.f()
Meh
 delattr(x, f)
 x.f()
Hello
 
 IOW, you can override a method with setattr() but you cannot delete a
 method with delattr().

Of course you can. You just need to know where methods are found. Hint: 
we write this:

class Example:
def method(self): ...


not this:

class Example:
def __init__(self):
def method(self): ...
self.method = method


Methods are attributes of the class, not the instance. Like all class 
attributes, you can retrieve them by doing a lookup on the instance, you 
can shadow them by storing an attribute of the same name on the instance, 
but you cannot rebind or delete them directly on the instance, since they 
aren't on the instance.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: confused about the different built-in functions in Python

2014-05-26 Thread Terry Reedy

On 5/26/2014 4:32 PM, Marko Rauhamaa wrote:


I stand corrected. I had thought the trampoline (bound method object)
was created once and for all.


Assuming that bound methods are immutable, this is an implementation 
detail, either way. However, it is common for a specific method to be 
called just once on a specific instance. If you have a mixed-case string 
Ss and want the lowercase version, ss = Ss.lower(), you keep ss around 
as long as needed. If the bound method is needed repeatedly, you can 
keep *that* around too.


stack = []
spush = stack.append
spop = stack.pop

for item in it:
  spush(item)
while stack and condition:
  p = process(spop)
...

--
Terry Jan Reedy

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


Re: Build tools, and Python 3 dependencies (was: How keep Python 3 moving forward)

2014-05-26 Thread Steven D'Aprano
On Mon, 26 May 2014 08:44:51 -0400, Roy Smith wrote:

 That makes even less sense. The build system runs under whatever
 version of Python it needs, and your code runs under whatever version
 of Python you like. The two don't affect each other at run time, and
 don't affect each other's testing dependencies.
 
 The are tightly integrated, and share code.

Well there's your problem, right there. Tight coupling is a *bad* thing, 
you're supposed to minimize it, not maximize it :-)

I'm having trouble understanding why your build system should be 
integrated with your production code. You should, in principle, be able 
to replace your build system with one written in Perl or bash without 
having to touch a single line of your application. If what you say is 
correct, your design tends towards the sort of perplexing errors like We 
added extra debugging code to the build script, and now the application 
won't print!

The programmer's attitude towards tightly coupled code ought to be like 
Batman's attitude towards crime: something to be stamped out, at any 
cost, unless it is absolutely for the purpose of a higher cause.

In Batman's case that higher cause is justice and the good of Gotham 
City. What's your higher cause?




-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Build tools, and Python 3 dependencies (was: How keep Python 3 moving forward)

2014-05-26 Thread Steven D'Aprano
Oh, I was a bit trigger-happy with my earlier post.

On Mon, 26 May 2014 08:44:51 -0400, Roy Smith wrote about his build 
system and production code:

 The are tightly integrated, and share code.

[...]

 When you start working with large systems, reducing complexity becomes
 important.  Every time you add a component, it comes with its own set of
 dependencies and constraints.  Those things come back to bite you when
 you least expect it.

How ironic that you have now got *more* constraints, *stronger* 
dependencies and *more* complexity than if you had written a less tightly 
coupled system.

Complexity is not, in and of itself, the most serious problem. But 
coupling is. You're now constrained that you cannot make changes to your 
application without simultaneously changing your build system. Although 
you have *fewer* dependencies, they've locked you in to a single course 
of action even more tightly than if you had more.

At least that's the impression that you have given.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Build tools, and Python 3 dependencies (was: How keep Python 3 moving forward)

2014-05-26 Thread Rustom Mody
On Tuesday, May 27, 2014 8:29:13 AM UTC+5:30, Steven D'Aprano wrote:
 On Mon, 26 May 2014 08:44:51 -0400, Roy Smith wrote:
 
 
 
  That makes even less sense. The build system runs under whatever
 
  version of Python it needs, and your code runs under whatever version
 
  of Python you like. The two don't affect each other at run time, and
 
  don't affect each other's testing dependencies.
 
  
 
  The are tightly integrated, and share code.
 
 
 
 Well there's your problem, right there. Tight coupling is a *bad* thing, 
 
 you're supposed to minimize it, not maximize it :-)
 
 
 
 I'm having trouble understanding why your build system should be 
 integrated with your production code. You should, in principle, be able 
 to replace your build system with one written in Perl or bash without 
 having to touch a single line of your application. If what you say is 

In theory, theory and practice are the same. In practice, they are not. 
s/theory/principle

[Whether thats Einsten or Yogi Berra I am not sure. I guess they
are the same in principle :D ]

Somewhat more seriously, I see this as a problem with all the super-kewl 
languages.  I know it most closely with python and haskell but I think its true 
across the board. It goes something like this:
- Language L is super-kewl
- Its so kewl it spawns its own ecosystem
- The ecosystem grows
- World domination is almost in sight -- everything to be done with
language L
- Unfortunately super-kewl ≠ omnipotent
- Things start crumbling at the edges

Case(s) in point: debian's apt is a mishmash of perl,shell etc
However it is more powerful than python's pip or Haskell's cabal.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Verify JSON Data

2014-05-26 Thread Rustom Mody
On Tuesday, May 27, 2014 12:05:58 AM UTC+5:30, Grant Edwards wrote:
 On 2014-05-26, gaurang shah  wrote:
  Would someone let me know how to verify JSON data in python.

 Parse the file into a data structure with whatever parser you like,
 then write a program to go thorugh the data structure and verify it.

  There are so many modules available to verify XML file, however i
  didn't find any good module to verify JSON Data.

 XML has various schema languages which can be used to write a
 definition of what is valid and what isn't valid.

 There really is anything like that in widespread use for JSON.

Google offers:

https://pypi.python.org/pypi/jsonschema
http://python-jsonschema.readthedocs.org/en/latest/validate/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-26 Thread Eric Snow

Eric Snow added the comment:

Okay, I didn't read closely enough. :)  It may be worth updating the title.

FWIW, the name module_from_spec confused me at first because my brain 
interpreted that as load_from_spec.  Keeping the name and purpose more 
focused might be helpful.  I have comments below to that effect.

If your proposed change still makes sense, could we keep it simpler for now?  
Something like this:

# in importlib.util
def module_from_spec(spec, module=None):
...
methods = _bootstrap._SpecMethods(spec)
if module is None:
return methods.create()
else:
methods.init_module_attrs(methods)
return module

Keeping the 2 methods on _SpecMethods is helpful for the PEP 406 (ImportEngine) 
superseder that I still want to get back to for 3.5. :)

--

 This serves two purposes. One is that it abstracts the
 loader.create_module() dance out so that's no longer a worry.

I'm not sure what dance you mean here and what the worry is.

 But more crucially it also means that if you have the function
 create the module for you then it will be returned with all of
 its attributes set without having to worry about forgetting that
 step.

So we would discourage calling ModuleType directly and encourage the use of a 
function in importlib.util that is equivalent to _SpecMethods.create().  That 
sounds good to me.  The use case for creating module objects directly is a 
pretty advanced one, but having a public API for that would still be good.

From this point of view I'd expect it to just look like this:

def new_module(spec):
return _SpecMethods(spec).create()

or given what I expect is the common use case currently:

def new_module(name, loader):
spec = spec_from_loader(name, loader)
return _SpecMethods(spec).create()

or together:

def new_module(spec_or_name, /, loader=None):
if isinstance(spec_or_name, str):
name = spec_or_name
if loader is None:
raise TypeError('missing loader')
spec = spec_from_loader(name, loader)
else:
if loader is not None:
raise TypeError('got unexpected keyword argument loader')
spec = spec_or_name
return _SpecMethods(spec).create()

To kill 2 birds with 1 stone, you could even make that the new signature of 
ModuleType(), which would just do the equivalent under the hood.  That way 
people keep using the same API that they already are (no need to communicate a 
new one to them), but they still get the appropriate attributes set properly.

 The module argument is just for convenience in those
 instances where you truly only want to override the module
 creation dance for some reason and really just want the
 attribute setting bit.

Perhaps it would be better to have a separate function for that (equivalent to 
just _SpecMethods.init_module_attrs()).  However, isn't that an even more 
uncommon use case outside of the import system itself?

 About the only other thing I can think of that people might
 still want is something like `importlib.util.load(spec)`

I agree it's somewhat orthogonal.  I'll address comments to issue #21235.

--

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Eric Snow

Eric Snow added the comment:

How about this replacement for direct use of Loader.load_module():

# in importlib.util
def load(spec_or_name, /, **kwargs):  # or load_from_spec
if isinstance(spec_or_name, str):
name = spec_or_name
if not kwargs:
raise TypeError('missing loader')
spec = spec_from_loader(name, **kwargs)
else:
if kwargs:
raise TypeError('got unexpected keyword arguments')
spec = spec_or_name
return _SpecMethods(spec).load()

(See a similar proposal for new_module() in msg219135, issue #20383).

--

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Berker Peksag

Berker Peksag added the comment:

See issue 18879 for more information about the change.

--
nosy: +berker.peksag, pitrou

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



[issue18879] tempfile.NamedTemporaryFile can close the file too early, if not assigning to a variable

2014-05-26 Thread Марк Коренберг

Марк Коренберг added the comment:

Is issue 21579 fixed in that bug? too many letters..sorry...

--
nosy: +mmarkk

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



[issue8743] set() operators don't work with collections.Set instances

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cd8b5b5b6356 by Raymond Hettinger in branch '3.4':
Issue 8743: Improve interoperability between sets and the collections.Set 
abstract base class.
http://hg.python.org/cpython/rev/cd8b5b5b6356

--

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



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ba84d1e9a742 by Raymond Hettinger in branch '2.7':
Issue #21481:  Teach argparse equality tests to return NotImplemented when 
comparing to unknown types.
http://hg.python.org/cpython/rev/ba84d1e9a742

--
nosy: +python-dev

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



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 510c8dc38749 by Raymond Hettinger in branch '3.4':
Issue #21481:  Teach argparse equality tests to return NotImplemented when 
comparing to unknown types.
http://hg.python.org/cpython/rev/510c8dc38749

--

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



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue13212] json library is decoding/encoding when it should not

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: rhettinger - bob.ippolito
nosy: +bob.ippolito

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



[issue13212] json library is decoding/encoding when it should not

2014-05-26 Thread Bob Ippolito

Bob Ippolito added the comment:

As Chris Rebert mentioned, the JSON standards have adopted this (unsurprising) 
behavior. Ruby hasn't, and I doubt Crockford has, but I think they're in the 
minority at this point. JavaScript's own JSON implementation works the same way 
json/simplejson does.

 JSON.parse(JSON.stringify('yay'))
yay

At best, I think it's probably worth a mention in the documentation, but not 
worth changing any code over.

--

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



[issue13212] json library is decoding/encoding when it should not

2014-05-26 Thread Bob Ippolito

Bob Ippolito added the comment:

In other words, I would consider this to be fixed by the documentation change 
made elsewhere.

--

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



[issue8743] set() operators don't work with collections.Set instances

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-26 Thread Jan-Philip Gehrcke

Jan-Philip Gehrcke added the comment:

I have updated the patch with a cross-reference to the sorted() built-in, which 
explains the arguments.

W.r.t. to Éric's suggestion: the sorted() doc refers to the sorting howto in 
the wiki. Now everything is connected.

--
Added file: http://bugs.python.org/file35365/sort_tut_02.diff

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-05-26 Thread Serhiy Storchaka

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


--
nosy: +gpolo, serhiy.storchaka

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +georg.brandl, ncoghlan

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



[issue20664] _findLib_crle and _get_soname broken on latest SunOS 5.11

2014-05-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge

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



[issue21560] gzip.write changes trailer ISIZE field before type checking - corrupted gz file after trying to write string

2014-05-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +nadeem.vawda

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



[issue13355] random.triangular error when low = high=mode

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note the catch on 2.7. triangular(10, 10.0) returns 10.0, but triangular(10, 
10.0, 10.0) returns 10. If then you divide by the result...

I proposed change return low to return low + 0.0.

--

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In any case this trick didn't work on Windows. And it can't work on Linux too 
when use new O_TMPFILE flag (issue21515).

--
nosy: +serhiy.storchaka

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Serhiy Storchaka

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


--
nosy: +haypo

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Марк Коренберг

Марк Коренберг added the comment:

Yes, but O_TMPFILE should be set ONLY  when used with TemporaryFile, not with 
NamedTemporaryFile. My problem refer only NamedTemporaryFile.

--

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2014-05-26 Thread Berker Peksag

Berker Peksag added the comment:

Here's a patch with a simple test case.

--
keywords: +patch
nosy: +berker.peksag
stage: needs patch - patch review
Added file: http://bugs.python.org/file35366/issue21578.diff

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



[issue21054] Improve indexing of syntax symbols

2014-05-26 Thread Ezio Melotti

Ezio Melotti added the comment:

All the current dependences are currently fixed.
Are you planning to add more in the future or can this issue be closed?

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python, ezio.melotti
type:  - enhancement

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2014-05-26 Thread Sunny K

Sunny K added the comment:

Hi Stefan,

I've added a new patch which only adds _fields, combining parts from my earlier 
patch and Andrew's (his patch does not account for visible unnamed fields).

--
Added file: http://bugs.python.org/file35367/structseq_fields.patch

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



[issue21072] Python docs and downloads not available for Egypt

2014-05-26 Thread Ezio Melotti

Ezio Melotti added the comment:

IIUC there was a similar issue from China, and on the old site we fixed it by 
adding http://legacy.python.org/getit/.
I don't know what was made to this page to make it work from China and if it 
still exists on the new website, but maybe the same trick could be used in this 
case as well?

Leo, can you check if the link I posted above works for you and try 
http://legacy.python.org/download/ as well?

--
nosy: +ezio.melotti

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



[issue21077] Turtle Circle Speed 0

2014-05-26 Thread Ezio Melotti

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


--
stage:  - needs patch
type:  - behavior

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



[issue21310] ResourceWarning when open() fails with io.UnsupportedOperation: File or stream is not seekable

2014-05-26 Thread Ezio Melotti

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


--
nosy: +haypo, pitrou, serhiy.storchaka
type:  - behavior

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



[issue21429] Input.output error with multiprocessing

2014-05-26 Thread Ezio Melotti

Ezio Melotti added the comment:

Can you provide more information about the error (e.g. the relevant piece of 
code where the error generates, if you can reproduce it every time or if it's 
sporadic, a minimal piece of code that can reproduce the same issue, etc.)?
I would also suggest to report this to the supybot issue tracker if the 
affected code is not specific to Limnoria.

--
nosy: +ezio.melotti
type:  - behavior

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



[issue21434] python -3 documentation is outdated

2014-05-26 Thread Ezio Melotti

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


--
nosy: +terry.reedy
stage: patch review - commit review
type:  - enhancement

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



[issue21445] Some asserts in test_filecmp have the wrong messages

2014-05-26 Thread Ezio Melotti

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


--
stage:  - commit review

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-26 Thread Serhiy Storchaka

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


--
nosy: +serhiy.storchaka

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



[issue21310] ResourceWarning when open() fails with io.UnsupportedOperation: File or stream is not seekable

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue20074.

--

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



[issue19980] Improve help('non-topic') response

2014-05-26 Thread Mark Lawrence

Mark Lawrence added the comment:

Anybody?

--

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



[issue21072] Python docs and downloads not available for Egypt

2014-05-26 Thread Leo Butcher

Leo Butcher added the comment:

Still not working, they both timeout
also the docs subdomain is the same

On Mon, May 26, 2014 at 12:19 PM, Ezio Melotti rep...@bugs.python.orgwrote:


 Ezio Melotti added the comment:

 IIUC there was a similar issue from China, and on the old site we fixed it
 by adding http://legacy.python.org/getit/.
 I don't know what was made to this page to make it work from China and if
 it still exists on the new website, but maybe the same trick could be used
 in this case as well?

 Leo, can you check if the link I posted above works for you and try
 http://legacy.python.org/download/ as well?

 --
 nosy: +ezio.melotti

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue21072
 ___


--

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



[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-26 Thread Brett Cannon

Brett Cannon added the comment:

First, about breaking up _SpecMethods: that was entirely on purpose. =) I 
honestly have found _SpecMethods a bit of a pain to work with because at every 
place where I have a spec object and I need to operate on it I end up having to 
wrap it and then call a method on it instead of simply calling a function (it 
also doesn't help that spec methods is structured as a collection of methods 
which can just operate as functions since they almost all have ``spec = 
self.spec`` at the beginning). I get you're hoping to make PEP 406 happen, but 
it actually needs to happen first. =) And as I said, the methods are 
essentially functions anyway so undoing any unraveling I may do won't be 
difficult to revert if PEP 406 actually comes about. IOW _SpecMethods feels 
like OOP just 'cause and not for any design reasons; it's been making my eye 
twitch when I look at that class.

Second, the dance that an advanced user has to worry about is does 
create_module exist, and if so did it not return None and if any of that is not 
true then return what types.ModuleType would give you is not exactly one line 
of code ATM. There is no reason to not abstract that out to do the right thing 
in the face of a loader.

Third, yes this would be to encourage people not to directly call 
types.ModuleType but call the utility function instead.

Fourth, I purposefully didn't bifurcate the code of types.ModuleType based on 
the type of what the first argument was. At best you could change it to take an 
optional spec as a second argument and use that, but if you did that and the 
name doesn't match the spec then what? I'm not going to promote passing in a 
loader because spec_from_loader() cannot necessarily glean all of the same 
information a hand-crafted spec could if the loader doesn't have every possible 
introspection method defined (I'm calling explicit is better than implicit to 
back that up). I also don't think any type should depend on importlib having 
been previously loaded to properly function if it isn't strictly required, so 
the code would have to be written entirely in C which I just don't want to 
write. =) Since it's going beyond simply constructing a new module but also 
initializing it I think it's fine to keeping it in importlib.util which also 
makes it all more discoverable for people than having to realize tha
 t types.ModuleType is the place to go to create a module and get its 
attributes initialized.

Fifth, fair enough on not needing the module argument. I will refactor the code 
for internal use of attribute initialization in testing and leave it at that.

--

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



[issue10510] distutils upload/register should use CRLF in HTTP requests

2014-05-26 Thread Ian Cordasco

Ian Cordasco added the comment:

Per discussion on twitter 
(https://twitter.com/merwok_/status/468518605135835136) I'm bumping this to 
make sure it's merged.

--

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Brett Cannon

Brett Cannon added the comment:

I think that's the wrong abstraction(it would be fine in a third-party library, 
though, that's trying to smooth over 3.3-3.4 transitions). Since 
importlib.util.find_spec() always returns a spec, then you want something more 
like::

  def load(spec):
loader = spec.loader
if hasattr(loader, 'exec_module'):
module = importlib.util.whatever_issue_20383_leads_to()
loader.exec_module(module)
return module
else:
loader.load_module(spec.name)
return sys.modules[spec.name]

Since this is Python 3.5 code we are talking about you don't have to worry 
about the find_loader/find_module case as find_spec wraps both of those and 
normalizes it all to just using specs. You could even tweak it to pass the 
module in explicitly and in the load_module branch make sure that the module is 
placed in sys.modules first so it essentially becomes a reload (but as both 
know that's not exactly the same nor pleasant in certain cases so probably best 
not exposed that way =).

If this exists in importlib.util then you make import_module() be 
(essentially)::

  def import_module(name, package):
fullname = resolve_name(name, package)
spec = find_spec(fullname)
return load(spec)

--
dependencies: +Add a keyword-only spec argument to types.ModuleType

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
dependencies: +Consider dropping importlib.abc.Loader.create_module()

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



[issue21581] Consider dropping importlib.abc.Loader.create_module()

2014-05-26 Thread Brett Cannon

New submission from Brett Cannon:

As Armin Ronacher pointed out, it's a bit odd having the importlib.abc.Loader 
ABC have a method whose default does nothing and having the method itself be 
entirely optional. Might as well just drop it from the ABC and instead just 
make sure that create_module() is documented appropriately (it's such an 
advanced use case it might also simplify things to not have it in the typical 
user's face).

--
components: Library (Lib)
messages: 219159
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Consider dropping importlib.abc.Loader.create_module()
type: behavior
versions: Python 3.5

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Brett Cannon

Brett Cannon added the comment:

Opened issue #21581 to discuss Armin's point about 
importlib.abc.Loader.create_module() being there but not being much use since 
the method is entirely optional.

--

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



[issue21477] Idle: improve idle_test.htest

2014-05-26 Thread Saimadhav Heblikar

Saimadhav Heblikar added the comment:

Summary for htest-26052014-34.diff and htest-26052014-27.diff
1. Adds htest for ReplaceDialog and SearchDialog
2. Removes the two canvases in TreeWidget as per code review comment. Now there 
is only a single ScrollableCanvas
3. Some text changes in spec dict messages

The corresponding 27 patch is to be applied on top of htest-25052014-27.diff.

Apart,

1. Wrt point 4 in msg219055, I think wrapper functions are required along with 
creating a new root.
It ensures the parent dialog is not destroyed, even 'accidently' and across 
different OS.
About the concern that clicking '[Next]' does not destroy the child:
We could have the following line in wrapper function(which creates a new root)-
 
parent.child = root

and, in the next() in run():
try:
root.child.destroy()
except AttributeError:
pass

To make things more readable, we could perhaps change the 'root' in run() to 
'parent' and ensure consistency.
With this, clicking '[Next]' destroys the child, before moving onto the next 
htest.
A drawback with this approach would be that, we would need to create a wrapper 
function for those tests which currently dont have one(See: configNameDialog, 
configHelpSource, GetKeysDialog etc.)



2. Htest's for GrepDialog, outputwindow, configDialog and Filelist are not 
progressing because of assert statements in macosxsupport.py.
I do not know the reasoning behind the assert statement either. Neither do I 
know how to 'ignore' it.
One way I found out is using the -O flag, but it is not pragmatic.
Another way is to have a macosxsupport._tk_type = other in the respective 
wrapper function.
But I do not know the effect of such a statement in a OSX environment.
If someone with a OSX environment wants to volunteer, please try running 
Lib/idlelib/configDialog.py with and without the insertion
macosxsupport._tk_type = other. With the insertion, the configDialog works on 
a Linux gnome environment and doesn't without it.
Funnily enough, the configDialog works as-is in Win7 which I tried on a VM.
One way would be to insert the above statment only if its a *nix environment.

--
Added file: http://bugs.python.org/file35368/htest-26052014-34.diff

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



[issue21477] Idle: improve idle_test.htest

2014-05-26 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com:


Added file: http://bugs.python.org/file35369/htest-26052014-27.diff

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



[issue21582] use the support.catpured_stdout/stderr context managers - test_asyncore

2014-05-26 Thread diana

New submission from diana:

Updated test_asyncore to use the support.catpured_stdout/stderr context 
managers rather than try/finally blocks.

--
components: Tests
files: use_support_captured_test_asyncore.patch
keywords: patch
messages: 219162
nosy: diana
priority: normal
severity: normal
status: open
title: use the support.catpured_stdout/stderr context managers - test_asyncore
versions: Python 3.5
Added file: 
http://bugs.python.org/file35370/use_support_captured_test_asyncore.patch

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



[issue21582] use support.catpured context managers - test_asyncore

2014-05-26 Thread diana

Changes by diana diana.joan.cla...@gmail.com:


--
title: use the support.catpured_stdout/stderr context managers - test_asyncore 
- use support.catpured context managers - test_asyncore

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



[issue21054] Improve indexing of syntax symbols

2014-05-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I plan to add more.

--

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



[issue21434] python -3 documentation is outdated

2014-05-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is documentation for the 2.7 '-3' command line option, which I presume has 
not changed at least since 2.7.0, rather than for 2to3, which has changed in 
different 3.x releases. If I am correct, the list of things -3 warns about has 
not changed. It might be more appropriate to rewrite the intro sentence to 
something like

Warn about Python 3.x incompatibilities which were not fixed by the original 
version of :ref:`2to3 2to3-reference`.

Benjamin, what do you think?

--
nosy: +benjamin.peterson

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



[issue21583] use support.catpured_stderr context manager - test_logging

2014-05-26 Thread diana

New submission from diana:

- Updated test_asyncore to use the support.catpured_stderr context manager
- Removed unused imports

--
components: Tests
files: use_support_captured_stderr_test_logging.patch
keywords: patch
messages: 219165
nosy: diana
priority: normal
severity: normal
status: open
title: use support.catpured_stderr context manager - test_logging
versions: Python 3.5
Added file: 
http://bugs.python.org/file35371/use_support_captured_stderr_test_logging.patch

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



[issue19980] Improve help('non-topic') response

2014-05-26 Thread Jessica McKellar

Jessica McKellar added the comment:

@BreamoreBoy, thanks for following up on this!


 I propose the following.  help('') returns help on strings in the same way 
 that help([]) and help({}) returns help on lists and dicts respectively,

Sounds good.

 further help(''.method) returns help on the string method or an attribute 
 error, so this appears to me consistent.

This already happens (which I think you are saying, but it's a bit confusing in 
reading your message which functionality you are proposing to add and which 
functionality you are restating that already exists).

 help('doh') returns enhanced output along the lines Terry suggested in 
 msg206157.

Sounds good.

 help('module') gives the path to the module as well as the help output, if 
 any, as I think this could be useful in cases where you're looking for 
 problems and have a stdlib module masked by a file of your own.

I think you are stating the current functionality?

 Note that I've tried looking at the test code and it didn't make much sense 
 to me, pointers welcome.

Do you have specific questions?

Terry suggests that help() tests for functionality using pydoc live in 
test_pydoc.py, and that help() tests for functionality not using pydoc live in 
test_site.py.

--

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



[issue21583] use support.catpured_stderr context manager - test_logging

2014-05-26 Thread diana

diana added the comment:

oops, typo:

- Updated test_logging (not test_asyncore) to use the support.catpured_stderr 
context manager

--

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



  1   2   >