Re: How to run script from interpreter?

2014-05-28 Thread onlyvinish
On Friday, January 19, 2001 1:22:23 AM UTC+5:30, Rolander, Dan wrote:
 What is the best way to run a python script from within the interpreter?
 What command should I use?
 
 Thanks,
 Dan

try using execfile(filename)
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: eGenix mxODBC Connect 2.1.0 - Python ODBC Database Interface

2014-05-28 Thread eGenix Team: M.-A. Lemburg

ANNOUNCING
  eGenix.com mxODBC Connect

Python ODBC Database Interface

Version 2.1.0


 mxODBC Connect is our commercially supported client-server product for
   connecting Python applications to relational databases
 in a truly platform independent way.


This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.1.0-GA.html


INTRODUCTION

The mxODBC Connect Database Interface for Python allows users to
easily connect Python applications to all major databases on the
market today in a highly portable, convenient and secure way.

Python Database Connectivity the Easy Way
-

Unlike our mxODBC Python extension, mxODBC Connect is designed as
client-server application, so you no longer need to find production
quality ODBC drivers for all the platforms you target with your Python
application.

Instead you use an easy to install royalty-free Python client library
which connects directly to the mxODBC Connect database server over the
network.

This makes mxODBC Connect a great basis for writing cross-platform
multi-tier database applications and utilities in Python, especially
if you run applications that need to communicate with databases such
as MS SQL Server and MS Access, Oracle Database, IBM DB2 and Informix,
Sybase ASE and Sybase Anywhere, MySQL, PostgreSQL, SAP MaxDB and many
more, that run on Windows or Linux machines.

Ideal for Database Driven Client Applications
-

By removing the need to install and configure ODBC drivers on the
client side and dealing with complicated network setups for each set
of drivers, mxODBC Connect greatly simplifies deployment of database
driven client applications, while at the same time making the network
communication between client and database server more efficient and
more secure.

For more information, please have a look at the mxODBC Connect product
page, in particular, the full list of available features.

For more information, please see the product page:

http://www.egenix.com/products/python/mxODBCConnect/


NEWS

mxODBC Connect 2.1.0 is a new minor release of our successful mxODBC
Connect product. These are the changes compared to mxODBC Connect
2.0.5.

Update to the mxODBC 3.3 API


mxODBC Connect 2.1 upgrades the mxODBC Connect Client to the new
mxODBC 3.3. APIs and enhancements.

Stored Procedures

 * mxODBC Connect now has full support for input, output and
   input/output parameters in stored procedures and stored functions,
   allowing easy integration with existing databases systems.

User Customizable Row Objects

 * Added support for user customizable row objects by adding
   cursor/connection .rowfactory and .row constructor attributes. When
   set, these are used to wrap the normal row tuples returned by the
   .fetch*() methods into dynamically created row objects.

 * Added new RowFactory classes to support cursor.rowfactory and
   cursor.row. These allow dynamically creating row classes that
   provide sequence as well as mapping and attribute access to row
   fields - similar to what namedtuples implements, but more efficient
   and specific to result sets.

Fast Cursor Types

 * Switched to forward-only cursor types for all database backends,
   since this provides a much better performance for MS SQL Server and
   IBM DB2 drivers.

 * Added a new .cursortype attribute to allow adjusting and inspecting
   the ODBC cursor type to be used for an mxODBC Connect cursor
   object. Default is to use forward-only cursors, but mxODBC also
   support several other useful cursor types such as static cursors
   with full support for result set scrolling.

More new Features

 * Enhanced cursor.prepare() to allow querying cursor.description
   right after the prepare step and not only after calling a
   cursor.execute*() method.

 * Added iterator/generator support to .executemany(). The parameters
   list can now be an iterator/generator, if needed.

 * Added new connection.dbapi property to easily access module level
   symbols from the connection object.

 * Timestamp seconds fraction resolution is now determined from the
   scale of a datetime/timestamp SQL column, using the
   connection.timestampresolution as lower bound, when using SQL type
   binding. In Python type binding mode, the
   connection.timestampresolution determines the scale with which a
   variable is bound. This allows for greater flexibility when dealing
   with database backends that don't provide full nano-second second
   resolution, such as e.g. MS SQL Server.

 * mxODBC Connect accepts Unicode 

Re: is there a list/group for beginners?

2014-05-28 Thread alister
On Tue, 27 May 2014 13:38:36 -0800, Deb Wyatt wrote:

 -Original Message-
 From: john_lada...@sbcglobal.net Sent: Tue, 27 May 2014 11:38:39 -0700
 (PDT)
 To: python-list@python.org Subject: Re: is there a list/group for
 beginners?
 
 Hi, Deb.
 
 Ten years ago (or eleven?), I was completely new to Python.  I could
 not begin to understand over 90 percent of what I was reading here in
 comp.lang.python.  Still, I asked my newbie questions here.  For the
 most part, I got excellent responses.  I think you're in the right
 place.
 --
 https://mail.python.org/mailman/listinfo/python-list
 
 thanks,John. I guess I was/am afraid to embarrass myself on this list,
 but then I accidentally posted a question meant for the tutor list and
 ended up getting more for my money than I expected :).  I really
 appreciate that the people on this list are so friendly and willing to
 help.
 
 
 FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
 Check it out at http://www.inbox.com/earth

To Avoid the biggest risk of upsetting people here it would help you to 
understand the failings of google groups which makes your posts hard to 
read for people using the Newsgroup or mailing list

https://wiki.python.org/moin/GoogleGroupsPython



-- 
There is no royal road to geometry.
-- Euclid
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python #13

2014-05-28 Thread himanshulkce
Thank you sir 


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


how avoid delay while returning from C-python api?

2014-05-28 Thread Lakshmipathi.G
Hi -

I have C-Python api like below.  It works fine, but the problem is
while invoking this method
from python script say

#cat script.py
snip
offset=0
size=4
write_object(offset,size)
/snip


This calls write_this_c() C api and returns quickly to next printf statement.
But the return call (Py_RETURN_NONE) takes something like 4-6 seconds.

-
static
PyMethodDef xyz_methods[] = {
{write_object, write_object, METH_VARARGS,write some stuff },
{NULL, NULL, 0, NULL}
};



static PyObject *
write_object(PyObject *self, PyObject *args)
{
int offset, size;
if (!PyArg_ParseTuple(args,ii, offset, size))
Py_RETURN_NONE;

printf(before call);
write_this_c(offset, size);
printf(after call);
Py_RETURN_NONE;  ##delay happens here
}

How to avoid this delay time? Thanks for any help/pointers!




Cheers,
Lakshmipathi.G
FOSS Programmer.
www.giis.co.in
-- 
https://mail.python.org/mailman/listinfo/python-list


IDE for python

2014-05-28 Thread Sameer Rathoud
Hello everyone,

I am new to python.

I am currently using python 3.3

With python I got IDLE, but I am not very comfortable with this.

Please suggest, if we have any free ide for python development.
-- 
https://mail.python.org/mailman/listinfo/python-list


答复: IDE for python

2014-05-28 Thread cheng.li
IPython for interactive testing.

Aptana or PyDev + eclipse as IDE

-邮件原件-
发件人: Python-list
[mailto:python-list-bounces+scrappedprince.li=gmail@python.org] 代表
Sameer Rathoud
发送时间: 2014年5月28日 18:43
收件人: python-list@python.org
主题: IDE for python

Hello everyone,

I am new to python.

I am currently using python 3.3

With python I got IDLE, but I am not very comfortable with this.

Please suggest, if we have any free ide for python development.
-- 
https://mail.python.org/mailman/listinfo/python-list

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


Re: IDE for python

2014-05-28 Thread Marko Rauhamaa
Sameer Rathoud sameer.rath...@gmail.com:

 Please suggest, if we have any free ide for python development.

emacs


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


Re: how avoid delay while returning from C-python api?

2014-05-28 Thread Ned Batchelder

On 5/28/14 6:22 AM, Lakshmipathi.G wrote:

Hi -

I have C-Python api like below.  It works fine, but the problem is
while invoking this method
from python script say

#cat script.py
snip
offset=0
size=4
write_object(offset,size)
/snip


This calls write_this_c() C api and returns quickly to next printf statement.
But the return call (Py_RETURN_NONE) takes something like 4-6 seconds.

-
static
PyMethodDef xyz_methods[] = {
{write_object, write_object, METH_VARARGS,write some stuff },
{NULL, NULL, 0, NULL}
};



static PyObject *
write_object(PyObject *self, PyObject *args)
{
 int offset, size;
 if (!PyArg_ParseTuple(args,ii, offset, size))
 Py_RETURN_NONE;

 printf(before call);
 write_this_c(offset, size);
 printf(after call);
 Py_RETURN_NONE;  ##delay happens here
}

How to avoid this delay time? Thanks for any help/pointers!


It can't be as simple as the Py_RETURN_NONE taking 4-6 seconds: hundreds 
of built-in functions in Python are coded exactly this way, and they 
don't have a delay on return.  Something else is going on.


How did you determine that it was the return that was taking the time?







Cheers,
Lakshmipathi.G
FOSS Programmer.
www.giis.co.in




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

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


Re: IDE for python

2014-05-28 Thread alister
On Wed, 28 May 2014 03:43:29 -0700, Sameer Rathoud wrote:

 Hello everyone,
 
 I am new to python.
 
 I am currently using python 3.3
 
 With python I got IDLE, but I am not very comfortable with this.
 
 Please suggest, if we have any free ide for python development.

there Are plenty
I use Geany a lightweight cross platform editor but you will probably get 
as (at least as )many different answers as there are posters here :-)



-- 
Time is the most valuable thing a man can spend.
-- Theophrastus
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread Mihamina Rakotomandimby

On 05/28/2014 01:43 PM, Sameer Rathoud wrote:

Please suggest, if we have any free ide for python development.


I think major IDEs in the place have their Python integration.
Did you make some search and tried each one?

With just the information you provided, every existing IDE is OK.

- What didnt you like in IDLE?
- What IDE do you use for anything else thant Python?



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


Re: how avoid delay while returning from C-python api?

2014-05-28 Thread Lakshmipathi.G
The statement after call printed to stdout and the script waits
there for few seconds. So I was assuming something delaying the return
value.

Just found out there is core-dump segmentation fault (core dumped)
python ..Probably fixing core dump should resolve the issue.
Thanks!


Cheers,
Lakshmipathi.G
FOSS Programmer.
www.giis.co.in
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread Chris Angelico
On Wed, May 28, 2014 at 8:43 PM, Sameer Rathoud
sameer.rath...@gmail.com wrote:
 I am currently using python 3.3

 With python I got IDLE, but I am not very comfortable with this.

 Please suggest, if we have any free ide for python development.

You don't really need an IDE, generally. A good text editor - I use
SciTE, but as alister said, there are as many viable answers as there
are posters - is all you need. Back when I wrote code in Q-BASIC,
VX-REXX, and then C and C++, I used IDEs, but even then the main
features I used were just smart text editors.

My preferred IDE, these days, is Debian Linux with Xfce, which gives
me a convenient workspace in which to run SciTE plus a few dozen
terminal windows. One of them will be dedicated to source control
(git, hg, or whatever the current project uses); some of those do have
GUI interfaces or editor integration, but I find it easiest to use the
command line. Another generally is for running the program, unless
it's one that permanently stays running (or is being remotely
manipulated via a TCP/IP link). Then, depending on what I'm doing, I
might have a few more... maybe a music player (or maybe that's VLC,
invoked via the Yosemite Project), maybe a few man pages, whatever
else I need. It's highly unlikely that anyone's written an IDE that
does everything I could possibly want, so I just use the computer's
desktop as that IDE. It can do anything! :)

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


Re: IDE for python

2014-05-28 Thread Sameer Rathoud
On Wednesday, May 28, 2014 4:21:22 PM UTC+5:30, Mihamina Rakotomandimby wrote:
 On 05/28/2014 01:43 PM, Sameer Rathoud wrote:
 
  Please suggest, if we have any free ide for python development.
 
 
 
 I think major IDEs in the place have their Python integration.
 
 Did you make some search and tried each one?
 
 
 
 With just the information you provided, every existing IDE is OK.
 
 
 
 - What didnt you like in IDLE?
 
 - What IDE do you use for anything else thant Python?

for C++ and C# development I prefer visual studio and for C++ try outs even 
codeblock is ok

For Java I use eclipse.

But first time I am trying python. I was trying some UI  with python. I have 
installed wingide. But i didn't liked it because for licenses messages even in 
trial version.

I was searching for spyder, but didn't got any helpful installable.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread Chris Angelico
On Wed, May 28, 2014 at 9:31 PM, Sameer Rathoud
sameer.rath...@gmail.com wrote:
 for C++ and C# development I prefer visual studio and for C++ try outs even 
 codeblock is ok

 For Java I use eclipse.

 But first time I am trying python. I was trying some UI  with python. I have 
 installed wingide. But i didn't liked it because for licenses messages even 
 in trial version.

 I was searching for spyder, but didn't got any helpful installable.

Yep, so you're accustomed to an IDE. But just try a good editor like
SciTE or Geany or emacs (or ... or ... or ...), and see how you like
it. As an added bonus, you can get to know one editor and use it for
everything, rather than having separate IDEs for separate languages.

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


Re: IDE for python

2014-05-28 Thread prashanth B.G
Hi Sameer,

   Try pycharm, ninja ide, wings ide .. These are light and will
help you to get started. Later on you can switch to vim which has many
plugins for python.

   Also feel free to take a look at this link on stackoverflow
comparing different features .

http://stackoverflow.com/questions/81584/what-ide-to-use-for-python

Thanks.




On Wed, May 28, 2014 at 5:01 PM, Sameer Rathoud sameer.rath...@gmail.comwrote:

 On Wednesday, May 28, 2014 4:21:22 PM UTC+5:30, Mihamina Rakotomandimby
 wrote:
  On 05/28/2014 01:43 PM, Sameer Rathoud wrote:
 
   Please suggest, if we have any free ide for python development.
 
 
 
  I think major IDEs in the place have their Python integration.
 
  Did you make some search and tried each one?
 
 
 
  With just the information you provided, every existing IDE is OK.
 
 
 
  - What didnt you like in IDLE?
 
  - What IDE do you use for anything else thant Python?

 for C++ and C# development I prefer visual studio and for C++ try outs
 even codeblock is ok

 For Java I use eclipse.

 But first time I am trying python. I was trying some UI  with python. I
 have installed wingide. But i didn't liked it because for licenses messages
 even in trial version.

 I was searching for spyder, but didn't got any helpful installable.
 --
 https://mail.python.org/mailman/listinfo/python-list




-- 
 *HAVE A NICE DAY *

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


Re: IDE for python

2014-05-28 Thread Mark Lawrence

On 28/05/2014 12:31, Sameer Rathoud wrote:

On Wednesday, May 28, 2014 4:21:22 PM UTC+5:30, Mihamina Rakotomandimby wrote:

On 05/28/2014 01:43 PM, Sameer Rathoud wrote:


Please suggest, if we have any free ide for python development.




I think major IDEs in the place have their Python integration.

Did you make some search and tried each one?



With just the information you provided, every existing IDE is OK.



- What didnt you like in IDLE?

- What IDE do you use for anything else thant Python?


for C++ and C# development I prefer visual studio and for C++ try outs even 
codeblock is ok

For Java I use eclipse.


Get the pydev plugin for eclipse.  Pydev uses pylint to flag up errors 
or warnings as you type, saves hours of work.




But first time I am trying python. I was trying some UI  with python. I have 
installed wingide. But i didn't liked it because for licenses messages even in 
trial version.

I was searching for spyder, but didn't got any helpful installable.



Also would you please use the mailing list 
https://mail.python.org/mailman/listinfo/python-list or read and action 
this https://wiki.python.org/moin/GoogleGroupsPython to prevent us 
seeing double line spacing and single line paragraphs, thanks.


--
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: IDE for python

2014-05-28 Thread Greg Schroeder

  Please suggest, if we have any free ide for python development.

Anything that writes text is fine.
I recommend the standard text editor for your OS (Notepad if you use
Windows, Textedit on Mac, whatever is on your GNU/Linux distro by
default) unless you know exactly what you don't like about it.

Greg


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


Unable to figure out ' invalid matrix input type -- ', u'1'

2014-05-28 Thread varun7rs
Hello Everyone, 

I am currently working on Cplex using Python API. I have a problem when I run 
the code. I keep getting this error about the invalid matrix input but I'm not 
able to figure out what it is. I would be grateful if any of you could help. My 
function is as below

def add_constraint(self, variables, coefficients, sense, rhs, name):
self.prob.linear_constraints.add(
  lin_expr = [[ variables, coefficients ]],
  senses =[sense],
  rhs =   [rhs],
  names = [name] )



Traceback (most recent call last):
  File RW10.py, line 569, in module
main(sys.argv[1:])
  File RW10.py, line 562, in main
solveVNEProblem( phy_network, demands, args.output)
  File RW10.py, line 116, in solveVNEProblem
solver.add_constraint( varNames, varCoeffs, E, 1.0, 
Location_Constraints1{}.format( demand.demandID ) )
  File RW10.py, line 26, in add_constraint
names = [name] )
  File 
/opt/ibm/ILOG/CPLEX_Studio125/cplex/python/x86-64_sles10_4.1/cplex/_internal/_subinterfaces.py,
 line 1187, in add
rmat = _C_HBMatrix(lin_expr, self._cplex._env_lp_ptr, 0, 
self._env.parameters.read.apiencoding.get())
  File 
/opt/ibm/ILOG/CPLEX_Studio125/cplex/python/x86-64_sles10_4.1/cplex/_internal/_matrices.py,
 line 74, in __init__
raise TypeError( invalid matrix input type -- , self._mat[0])
TypeError: (' invalid matrix input type -- ', u'1')


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


Re: IDE for python

2014-05-28 Thread Chris Angelico
On Wed, May 28, 2014 at 9:46 PM, Greg Schroeder gmschroe...@gmail.com wrote:
  Please suggest, if we have any free ide for python development.

 Anything that writes text is fine.
 I recommend the standard text editor for your OS (Notepad if you use
 Windows, Textedit on Mac, whatever is on your GNU/Linux distro by
 default) unless you know exactly what you don't like about it.

No. Don't use Notepad for anything! It's easy enough to get a better
editor. Among its other faults, Notepad:

1) Has problems with LF line endings (they vanish, and you have hugely
long lines)
2) Puts three junk bytes onto the beginning of a file that it
considers saved as UTF-8
3) Doesn't understand coding cookies, and will happily save something
in a different encoding like CP-1252 (which it calls ANSI)
4) Guesses encodings on load, giving rise to the famous Bush hid the
facts trick - although this is unlikely to be a problem with
something of decent size
5) Has issues with large files - or at least, it did last time I
tried; this may no longer be true with Windows 7/8

Default text editors on the Linux distros I've used have been far
better, but still less than ideal. With Debian Squeeze, I got a gedit
that bugged me in several ways, which is what pushed me onto SciTE.
You can certainly start coding with gedit, though. The issues that I
had with it were relating to heavy-duty usage that I do, where I'm
basically spending an entire day delving into code and moving stuff
around. These days, though, I'd rather have one editor on both the
platforms I use (Windows and Linux, each in multiple variants), as it
allows me to share configs and comfortable keystrokes. There are
plenty of cross-platform editors to choose from.

So, I agree with your analysis, as regards gedit (know exactly what
you don't like about it). If it doesn't bug you, use it. But if
Notepad doesn't bug you, *still don't use it*, because it's like
driving a car that isn't structurally sound. It might not be you that
gets hurt by it... or it might not be for quite a while that you see
the problems... but the pain will happen.

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


Re: IDE for python

2014-05-28 Thread Sameer Rathoud
On Wednesday, May 28, 2014 5:16:41 PM UTC+5:30, Greg Schroeder wrote:
   Please suggest, if we have any free ide for python development.
 
 
 
 Anything that writes text is fine.
 
 I recommend the standard text editor for your OS (Notepad if you use
 
 Windows, Textedit on Mac, whatever is on your GNU/Linux distro by
 
 default) unless you know exactly what you don't like about it.
 
 
 
 Greg

Right now I am looking for ide on windows 7 platform.

Actually, I shouldn't say this, But I am bit use to intellisense and on go 
warnings and error and my text editor (Notepad) doesn't provide me that feature 
 .
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread Sameer Rathoud
On Wednesday, May 28, 2014 6:26:46 PM UTC+5:30, Sameer Rathoud wrote:
 On Wednesday, May 28, 2014 5:16:41 PM UTC+5:30, Greg Schroeder wrote:
 
Please suggest, if we have any free ide for python development.
 
  
 
  
 
  
 
  Anything that writes text is fine.
 
  
 
  I recommend the standard text editor for your OS (Notepad if you use
 
  
 
  Windows, Textedit on Mac, whatever is on your GNU/Linux distro by
 
  
 
  default) unless you know exactly what you don't like about it.
 
  
 
  
 
  
 
  Greg
 
 
 
 Right now I am looking for ide on windows 7 platform.
 
 
 
 Actually, I shouldn't say this, But I am bit use to intellisense and on go 
 warnings and error and my text editor (Notepad) doesn't provide me that 
 feature  .

one more query, do we have any add-in available for python on visual studio 
2010  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread Steven D'Aprano
On Wed, 28 May 2014 03:43:29 -0700, Sameer Rathoud wrote:

 Hello everyone,
 
 I am new to python.
 
 I am currently using python 3.3
 
 With python I got IDLE, but I am not very comfortable with this.
 
 Please suggest, if we have any free ide for python development.

What operating system are you using? The best IDE for Python is Unix or 
Linux:

http://blog.sanctum.geek.nz/series/unix-as-ide/


My IDE is to have three GUI windows open:

* A web browser for searching the Internet. Any browser will do, but I 
prefer Firefox.

* A tabbed editor. I prefer kate (KDE 3 version, not KDE 4), but geany is 
also good. At a pinch gedit will do. kwrite is another good editor, but 
not tabbed, and it lacks some of the features of kate.

* An xterm or console app, again with tabs. I like KDE 3's konsole, but 
any modern, configurable, tabbed console will do.

If I'm working collaboratively with others, I'll also have an IRC client 
open, for chatting. Or being distracted, more likely. I'll often also 
have a Unicode character selector open, such as KCharSelect or Gnome 
Charmap.

I open a few tabs in the console:

* At least one tab running in a Python interactive interpreter, for 
testing small snippets of code, running the Python interactive help() 
system, and so forth.

* At least one tab for running my code, or my unit tests.

* Another tab for managing files, including source control (hg or git).

Some people like to do all of this from a single tab, using the screen 
command to manage virtual tabs. I am not one of those people. For the 
same reason, I prefer GUI editors over emacs or vim.




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


Re: IDE for python

2014-05-28 Thread Sameer Rathoud
On Wednesday, May 28, 2014 6:05:08 PM UTC+5:30, Mark Lawrence wrote:
 On 28/05/2014 12:31, Sameer Rathoud wrote:
 
  On Wednesday, May 28, 2014 4:21:22 PM UTC+5:30, Mihamina Rakotomandimby 
  wrote:
 
  On 05/28/2014 01:43 PM, Sameer Rathoud wrote:
 
 
 
  Please suggest, if we have any free ide for python development.
 
 
 
 
 
 
 
  I think major IDEs in the place have their Python integration.
 
 
 
  Did you make some search and tried each one?
 
 
 
 
 
 
 
  With just the information you provided, every existing IDE is OK.
 
 
 
 
 
 
 
  - What didnt you like in IDLE?
 
 
 
  - What IDE do you use for anything else thant Python?
 
 
 
  for C++ and C# development I prefer visual studio and for C++ try outs even 
  codeblock is ok
 
 
 
  For Java I use eclipse.
 
 
 
 Get the pydev plugin for eclipse.  Pydev uses pylint to flag up errors 
 
 or warnings as you type, saves hours of work.
 
 
 
 
 
  But first time I am trying python. I was trying some UI  with python. I 
  have installed wingide. But i didn't liked it because for licenses messages 
  even in trial version.
 
 
 
  I was searching for spyder, but didn't got any helpful installable.
 
 
 
 
 
 Also would you please use the mailing list 
 
 https://mail.python.org/mailman/listinfo/python-list or read and action 
 
 this https://wiki.python.org/moin/GoogleGroupsPython to prevent us 
 
 seeing double line spacing and single line paragraphs, thanks.
 
 
 
 -- 
 
 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

Hi,

Thanks a lot everyone, for your valuable suggestion. 

I have successfully plugged-in PyDev and it is working great for me.

Once again thanks a lot
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread William Ray Wing
On May 28, 2014, at 6:43 AM, Sameer Rathoud sameer.rath...@gmail.com wrote:

 Hello everyone,
 
 I am new to python.
 
 I am currently using python 3.3
 
 With python I got IDLE, but I am not very comfortable with this.
 
 Please suggest, if we have any free ide for python development.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

There are several comparison tables and reviews of Python IDEs on the web.
You should check the following and see what suits you best:

http://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments#Python

http://www.pythoncentral.io/comparison-of-python-ides-development/

https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

http://stackoverflow.com/questions/81584/what-ide-to-use-for-python

http://pedrokroger.net/choosing-best-python-ide/

http://spyced.blogspot.com/2005/09/review-of-6-python-ides.html

Good Luck,
-Bill

PS: As it happens, I use (and like) Wing IDE, but have NO relation to the 
development company,
other than as a satisfied user.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread Mark H Harris

On 5/28/14 5:43 AM, Sameer Rathoud wrote:


I am currently using python 3.3
With python I got IDLE, but I am not very comfortable with this.
Please suggest, if we have any free ide for python development.


I tend to agree with Chris  Steven on this... a good gnu/linux desktop 
is the best IDE (debian, xfce, terminals galore)


Early in my unix career I learned VI (now VIM) and find that for most 
editing jobs (even from remote) --- can't be beat.


OTOH, I would highly recommend getting comfortable with IDLE; especially 
if you're using 3.3+ /   the modern IDLE works, is stable, and has many 
advantages over just a tabbed editor. It is highly configurable, simple 
and elegant, not to mention that its written against tkinter with pure 
python. Today I'm using IDLE for python development almost exclusively.


You no doubt are getting comfortable with python's indentation code 
blocking delimiting anomaly. IDLE helps with that. Yes, you can use 
tabs, but you shouldn't (for several reasons, I spare you). Typically 
the indentation is 4 spaces; IDLE handles this for you automatically 
(mostly) and allows the 4 spaces to be reconfigured.


The only really irritating aspect of IDLE which I had to get used to was 
that the interactive REPL provides no way to clear the screen. Its 
debugging capabilities (and undo levels) more than make up for that tiny 
small snag.


You will come to appreciate the class path browser, recent files, c. 
The default highlight colors are well chosen (they may be changed) and 
the window size and fonts may be changed. I think IDLE looks good. Its 
clean, clear, and functional.


I guess what I'm encouraging you to do is be patient with IDLE until you 
get a grip on it. There's more to it than meets the eye, at first.


marcus

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


Re: Unable to figure out ' invalid matrix input type -- ', u'1'

2014-05-28 Thread Mark Lawrence

On 28/05/2014 13:41, varun...@gmail.com wrote:

Hello Everyone,

I am currently working on Cplex using Python API. I have a problem when I run 
the code. I keep getting this error about the invalid matrix input but I'm not 
able to figure out what it is. I would be grateful if any of you could help. My 
function is as below

def add_constraint(self, variables, coefficients, sense, rhs, name):
 self.prob.linear_constraints.add(
   lin_expr = [[ variables, coefficients ]],
   senses =[sense],
   rhs =   [rhs],
   names = [name] )



Traceback (most recent call last):
   File RW10.py, line 569, in module
 main(sys.argv[1:])
   File RW10.py, line 562, in main
 solveVNEProblem( phy_network, demands, args.output)
   File RW10.py, line 116, in solveVNEProblem
 solver.add_constraint( varNames, varCoeffs, E, 1.0, 
Location_Constraints1{}.format( demand.demandID ) )
   File RW10.py, line 26, in add_constraint
 names = [name] )
   File 
/opt/ibm/ILOG/CPLEX_Studio125/cplex/python/x86-64_sles10_4.1/cplex/_internal/_subinterfaces.py,
 line 1187, in add
 rmat = _C_HBMatrix(lin_expr, self._cplex._env_lp_ptr, 0, 
self._env.parameters.read.apiencoding.get())
   File 
/opt/ibm/ILOG/CPLEX_Studio125/cplex/python/x86-64_sles10_4.1/cplex/_internal/_matrices.py,
 line 74, in __init__
 raise TypeError( invalid matrix input type -- , self._mat[0])
TypeError: (' invalid matrix input type -- ', u'1')


Thank You



I don't know but I'll guess that should be a letter l and not the number 1.

--
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: IDE for python

2014-05-28 Thread Mark Lawrence

On 28/05/2014 14:01, Sameer Rathoud wrote:

I've had to snip umpteen lines that gg has added so *please* use the 
mailing list https://mail.python.org/mailman/listinfo/python-list or 
read and action this https://wiki.python.org/moin/GoogleGroupsPython to 
prevent us seeing double line spacing and single line paragraphs, thanks.



one more query, do we have any add-in available for python on visual studio 2010



Python Tools for Visual Studio here http://pytools.codeplex.com/ but I 
don't think it supports the express edition.


--
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: How to run script from interpreter?

2014-05-28 Thread Terry Reedy

On 5/28/2014 3:44 AM, onlyvin...@gmail.com wrote:

On Friday, January 19, 2001 1:22:23 AM UTC+5:30, Rolander, Dan wrote:

What is the best way to run a python script from within the interpreter?
What command should I use?

Thanks,
Dan


try using execfile(filename)

or in 3.x
with open(filename) as f: exec f

These both assume that you want to run the script in the same process as 
the interpreter and within the module containing the statement. This is 
rare. People usually either want to import into a separate module or run 
in a separate process. For the latter, use the subprocess module and the 
same command line that you would use in a console.


--
Terry Jan Reedy

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


Re: IDE for python

2014-05-28 Thread Wolfgang Keller
 With python I got IDLE, but I am not very comfortable with this.
 
 Please suggest, if we have any free ide for python development.

There are a lot of IDEs for Python.

One classic is WingIDE. Available for free is a 101 edition. Runs on
all major operating systems. Implemented itself in Python.

An editor that's completely implemented in Python is Editra. With
plugins you can turn it into an almost IDE as well.

Sincerely,

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


Re: How to run script from interpreter?

2014-05-28 Thread Mark H Harris

On 5/28/14 2:44 AM, onlyvin...@gmail.com wrote:

On Friday, January 19, 2001 1:22:23 AM UTC+5:30, Rolander, Dan wrote:

What is the best way to run a python script from within the interpreter?
What command should I use?



try using execfile(filename)



What type of script?  python?  bash?   tcl?   other?

If you want to use python as a shell-glue you can try using system.

 from os import system
 def function_name([parms])
  blah blah
  rc = system(your_script_name)


When you call function_name within the python interpreter 
your_script_name  will be called using system.



OTOH, if you are wanting to run a python script within the interpreter 
then just import the names you want from your_script.py file and then 
call the name... like main, forinstance.


 from my_script import main
 main([parms])

Within your_script.py define a main function:

def main([parms]):
blah blah
return rc

-

OTOH,  just write the script.py file (top down procedural) and then 
import it:


 import my_script.py


marcus

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


Re: IDE for python

2014-05-28 Thread Ernest Bonat, Ph.D.
I believe in IDE with a complete project structure development and
debugging tool. I have to time for a lot of typing. Mi option is Eclipse
IDE with PyDev plugin.

Thanks


On Wed, May 28, 2014 at 9:24 AM, Wolfgang Keller felip...@gmx.net wrote:

  With python I got IDLE, but I am not very comfortable with this.
 
  Please suggest, if we have any free ide for python development.

 There are a lot of IDEs for Python.

 One classic is WingIDE. Available for free is a 101 edition. Runs on
 all major operating systems. Implemented itself in Python.

 An editor that's completely implemented in Python is Editra. With
 plugins you can turn it into an almost IDE as well.

 Sincerely,

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




-- 
Thanks

Ernest Bonat, Ph.D.
Senior Software Engineer
Senior Business Statistics Analyst
Mobile: 503.730.4556
Email: ernest.bo...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread funky
import pygame
import random
import time
import sys
black = (0, 0, 0)
white = (255, 255, 255)
red = (255, 0, 0)

class Block(pygame.sprite.Sprite):
def __init__(self, color, width, height):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface([width, height])
self.image.fill(color)
self.rect = self.image.get_rect()
def reset_pos(self):
self.rect.y = -20
self.rect.x = random.randrange(700)


def update(self):
self.rect.y +=1
if self.rect.y  410:
self.rect.y = -20
self.rect.x = random.randrange(700)


pygame.init()

screen_width = 700
screen_height = 400
screen = pygame.display.set_mode([screen_width, screen_height])
block_list = pygame.sprite.Group()
wall_list = pygame.sprite.Group()
all_sprites_list = pygame.sprite.Group()


for i in range(50):
color = (random.randint(40, 255), random.randint(40, 255), 
random.randint(40, 255))
block = Block(color, 20, 15)
block.rect.x = random.randrange(screen_width)
block.rect.y = random.randrange(screen_height)
block_list.add(block)
all_sprites_list.add(block)


player = Block(red, 20, 15)
all_sprites_list.add(player)


done = False
clock = pygame.time.Clock()
score = 0
minutes = 0
seconds = 0
time_start = 0
while done == False:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done == True
while True:
sys.stdout.write(\r{minutes} Minutes {seconds} 
Seconds.format(minutes=minutes, seconds=seconds))
sys.stdout.flush()
time.sleep(1)
seconds = int(time.time() - time_start) - minutes * 60



for x in range(1, 1000):  
screen.fill(white)


blocks_hit_list = pygame.sprite.spritecollide(player, block_list, False)

for block in blocks_hit_list:
if block  0:
score += 1
print score
block.reset_pos()

font = pygame.font.Font(None, 25)
text2 = font.render(time left:  + str(seconds), True, black)
text = font.render(Score:  + str(score), True, black)
screen.blit(text, [20, 20])
screen.blit(text2,[0, 20])

pos = pygame.mouse.get_pos()
player.rect.x=pos[0]
player.rect.y=pos[1]
block_list.update()



all_sprites_list.draw(screen)
clock.tick(120)
pygame.display.flip()
if seconds == 60:
pygame.quit()
  

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


Re: IDE for python

2014-05-28 Thread Deb Wyatt



 On 05/28/2014 01:43 PM, Sameer Rathoud wrote:
 
 Please suggest, if we have any free ide for python development.
 
snip 
 But first time I am trying python. I was trying some UI  with python. I
 have installed wingide. But i didn't liked it because for licenses
 messages even in trial version.
 
snip.
 --
 https://mail.python.org/mailman/listinfo/python-list

I'm using http://wingware.com/downloads/wingide-101.  no irritating messages. 
It's not the full version, but it works well for me.  I was using Geany before 
that and can't remember what Geany did to irritate me lol.  Everybody has their 
favorites.  I hope you find an ide that you love.

Deb in WA, USA


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks  orcas on your 
desktop!
Check it out at http://www.inbox.com/marineaquarium


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


Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread Gary Herron

On 05/28/2014 10:32 AM, funky wrote:
  100+ lines of code removed.

No way.  This is not a paid service, but rather a community of Python 
users.  You can get lots of help here, but you have to put in some 
work.  Please take the time to tell us:

  What this code should do.
  What it actually does.
  Why you think it's wrong.

You should also tell us what version of Python you are using, and on 
what platform you are running it.


Moreover, please reduce down to a bare minimum, the amount of code 
needed to show us the part that fails.


Gary Herron

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


Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread John Gordon
In 8bc01036-ee9e-4de9-b569-7039dcc05...@googlegroups.com funky 
benjaminherna...@gmail.com writes:

What do you want the program to do?
What is it doing instead?
Do you get any error messages?

Don't just throw code at us and ask us to fix it...

-- 
John Gordon Imagine what it must be like for a real medical doctor to
gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'.

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


Re: how avoid delay while returning from C-python api?

2014-05-28 Thread Stefan Behnel
Lakshmipathi.G, 28.05.2014 12:22:
 I have C-Python api like below.  It works fine, but the problem is
 while invoking this method
 from python script say
 
 #cat script.py
 snip
 offset=0
 size=4
 write_object(offset,size)
 /snip
 
 
 This calls write_this_c() C api and returns quickly to next printf statement.
 But the return call (Py_RETURN_NONE) takes something like 4-6 seconds.
 
 -
 static
 PyMethodDef xyz_methods[] = {
 {write_object, write_object, METH_VARARGS,write some stuff },
 {NULL, NULL, 0, NULL}
 };
 
 
 
 static PyObject *
 write_object(PyObject *self, PyObject *args)
 {
 int offset, size;
 if (!PyArg_ParseTuple(args,ii, offset, size))
 Py_RETURN_NONE;
 
 printf(before call);
 write_this_c(offset, size);
 printf(after call);
 Py_RETURN_NONE;  ##delay happens here
 }
 
 How to avoid this delay time? Thanks for any help/pointers!

You already found the problem yourself, so let me just give you a general
advice that you can avoid a lot of the hassle of writing code like the
above and struggling to get it right by writing it in Cython instead of
plain C. Here's a complete example of the above code in Cython, including
the module setup code etc., but without the bugs:

# external declarations:

cdef extern from someheader.h:
 void write_this_c(int offset, int size)

# your module function:

def write_object(int offset, int size):
write some stuff
print(before call)
write_this_c(offset, size)
print(after call)

That's it.

Stefan


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


Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread Grant Edwards
On 2014-05-28, funky benjaminherna...@gmail.com wrote:

[program that apparently doesn't work]

I'll fix it for you.  My rates are $150/hour with a 4-hour minimum
paid up-front.

-- 
Grant Edwards   grant.b.edwardsYow! PUNK ROCK!!  DISCO
  at   DUCK!!  BIRTH CONTROL!!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread Rustom Mody
On Wednesday, May 28, 2014 4:13:29 PM UTC+5:30, Sameer Rathoud wrote:
 Hello everyone,

 I am new to python.

 I am currently using python 3.3

 With python I got IDLE, but I am not very comfortable with this.

 Please suggest, if we have any free ide for python development.

Im not going to add to the answers.
I do suggest you read 
http://blog.osteele.com/posts/2004/11/ides

and decide
- where you think you fall in the spectrum
- where you would like to be
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 3 is killing Python

2014-05-28 Thread Larry Martell
Somthing I came across in my travels through the ether:

https://medium.com/@deliciousrobots/5d2ad703365d/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 is killing Python

2014-05-28 Thread Johannes Bauer
On 28.05.2014 21:23, Larry Martell wrote:
 Somthing I came across in my travels through the ether:
 
 https://medium.com/@deliciousrobots/5d2ad703365d/

Sub-headline The Python community should fork Python 2. Which could
also read Someone else should REALLY fork Py2 because I'm mad about Py3
yet too lazy to fork Py2 myself.

I wish all these ridiculous dumb whiners would finally shut up and fork
Python away. That would be win-win: They could use their fork of 2.4
forever and ever, maybe fork 1.4 too while they're at it. Then maintain
it. Above all: They would complain to each other and stay away from the
mailing lists of people who actually *embrace* progress and who
appreciate the wonderful features Py3 has given us.

What a wonderful world it would be. So, I agree with the above blogpost.
Some lazy blogwriting bum should fork Py2!

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: Python 3 is killing Python

2014-05-28 Thread Marko Rauhamaa

I agree that Py3 made a grave error in breaking backward-compatibility.
However, that's the reality and the transition will take place over
time, possibly even before IPv6 overtakes IPv4 in popularity.

But then, I was never really beholden to third-party libraries and
frameworks. Instead, the batteries-included philosophy still has a great
appeal to me.


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


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

2014-05-28 Thread Tim Golden

On 28/05/2014 06:08, Tim Golden wrote:

On 28/05/2014 00:01, ps16thypresenceisfullnessof...@gmail.com wrote:


I want users to be able to enter paths in the XML file exactly the
way they would be entered in a Windows shortcut. Since it is possible
to make a Windows shortcut for path-to-script.py without the
python.exe in front of it and have it open in its own command prompt,
I want to be able to do the same thing in my XML file, but this is
what I cannot figure out.


Anything done through shortcuts is making use of the Windows Shell API.
To mimic that behaviour, you could try using that; in this case,
ShellExecute[Ex]. For simple purposes, this is exposed in Python as
os.startfile. If you need more control, you'd have to use the API call
directly, either via ctypes or via the pywin32 libraries under the
win32com.shell package.

To mimic the behaviour exactly (if that is a requirement), you could
actually create a temporary shortcut with the desired information and
invoke it via os.startfile.

I haven't followed the thread (and I'm offline at the moment) so I'll
wait until I've seen it before I comment on the shlex.split / \\ dance
above. On the surface, though, I'm not sure what it's achieving. [All
right, I didn't wait :)].


I've just read the original post. My answer above isn't quite on the 
nail (although it might still be useful). If you're prepared to use the 
pywin32 libraries, then you could use win32api.FindExecutable to provide 
a first argument to the Popen constructor, followed by the others in 
your app/ data. Something like this:


code
import subprocess
import win32api

# ...
for app_path in app_paths:
args = ... split ...
_, exe = win32api.FindExecutable(args[0])
if exe != os.path.abspath(args[0]):
args = [exe] + args
subprocess.call(args)

/code

As to the shlex dance, I *think* you're trying to break the command line 
up, expand any env vars, and then pass it along to Popen as above?
If your app/ data were formatted as though for a Windows command-line, 
ie with the paths double-quoted if they contain spaces, then shlex 
should do the right thing by it without any further messing around.


So, if this example:

app name=LibreOffice Writer%ProgramFiles%\LibreOffice 
4\program\swriter.exe C:\Users\Timothy\Documents\myfile.odt/app


were instead:

app name=LibreOffice Writer%ProgramFiles%\LibreOffice 
4\program\swriter.exe C:\Users\Timothy\Documents\myfile.odt/app


then the shlex dance would just be:

args = [os.path.expandvars(i) for i in shlex.split(app_path)]

Although, assuming associations were set up in the usual way, the code I 
outlined above to use FindExecutable would cope with this without the 
need to specify the swriter.exe. As would the os.startfile approach I 
suggested earlier.


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


Re: Python 3 is killing Python

2014-05-28 Thread Paul Rubin
Larry Martell larry.mart...@gmail.com writes:
 Somthing I came across in my travels through the ether:
 [1]https://medium.com/@deliciousrobots/5d2ad703365d/

Python 3 can revive Python https://medium.com/p/2a7af4788b10
  long HN comment thread: https://news.ycombinator.com/item?id=7801834

Python 3 is fine http://sealedabstract.com/rants/python-3-is-fine/

OT: wow that medium site is obnoxious.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 is killing Python

2014-05-28 Thread Larry Martell
On Wed, May 28, 2014 at 2:49 PM, Paul Rubin no.email@nospam.invalid wrote:

 Larry Martell larry.mart...@gmail.com writes:
  Somthing I came across in my travels through the ether:
  [1]https://medium.com/@deliciousrobots/5d2ad703365d/

 Python 3 can revive Python https://medium.com/p/2a7af4788b10
   long HN comment thread: https://news.ycombinator.com/item?id=7801834

 Python 3 is fine http://sealedabstract.com/rants/python-3-is-fine/

 OT: wow that medium site is obnoxious.


No company that I work for is using python 3 - they just have too much of
an investment in a python 2 code base to switch. I'm just saying.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 is killing Python

2014-05-28 Thread Chris Angelico
On Thu, May 29, 2014 at 5:58 AM, Larry Martell larry.mart...@gmail.com wrote:
 No company that I work for is using python 3 - they just have too much of an
 investment in a python 2 code base to switch. I'm just saying.

And that's not a problem. Every whinging blog author seems to forget
that Python 2.7 support is going to continue for a long time! Yes, you
won't get new features. But the recommendation is new and unfettered
projects should take advantage of Python 3, not every Python 2
project needs to be ported. There've been some recent discussions
about exactly what security fixes and improvements can be backported;
the underlying guiding principle is it's acceptable and expected that
there will be large, net-facing Python 2 applications for the
foreseeable future.

Or maybe the complaint is that there are fancy new features in Python
3.x that aren't in 2.7? Oh wait, that directly contradicts the whine.
So if Python 3 has added nothing, what's the rush to move onto it?

Whiners gonna whine.

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


Re: Python 3 is killing Python

2014-05-28 Thread Mark Lawrence

On 28/05/2014 20:58, Larry Martell wrote:

On Wed, May 28, 2014 at 2:49 PM, Paul Rubin no.email@nospam.invalid
mailto:no.email@nospam.invalid wrote:

Larry Martell larry.mart...@gmail.com
mailto:larry.mart...@gmail.com writes:
  Somthing I came across in my travels through the ether:
  [1]https://medium.com/@deliciousrobots/5d2ad703365d/

Python 3 can revive Python https://medium.com/p/2a7af4788b10
   long HN comment thread: https://news.ycombinator.com/item?id=7801834

Python 3 is fine http://sealedabstract.com/rants/python-3-is-fine/

OT: wow that medium site is obnoxious.


No company that I work for is using python 3 - they just have too much
of an investment in a python 2 code base to switch. I'm just saying.



So you're happy because you've support until at least 2020, and the 
people using Python 3 are happy, mainly because of the vastly improved 
unicode handling via the FSR and asyncio in 3.4.  Presumably the only 
unhappy people are those who keep bleating on about forking Python to 
produce a 2.8, or has work on this already started without my knowledge?


--
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: Command prompt not shown when running Python script with subprocess on Windows

2014-05-28 Thread ps16thypresenceisfullnessofjoy
Thank you for your reply.

I think I'll use PyWin32 if it's available on the user's system, and otherwise 
fall back to using subprocess.Popen, since I want my script to be 
cross-platform. os.startfile won't work for me because you can't pass arguments 
to the file being started. (When I first asked my question, I was thinking I 
might just need to pass a certain STARTUPINFO flag to subprocess.Popen, but it 
looks like that's not the solution.)

A few examples from the interactive interpreter should help to explain why I am 
doing the \ \\ dance (I used raw strings in these examples so that I wouldn't 
need to escape the backslashes):

 import shlex
 shlex.split(r'C:\Users\Timothy\Documents\Python\myscript.py')
['C:UsersTimothyDocumentsPythonmyscript.py']
 shlex.split(r'C:\\Users\\Timothy\\Documents\\Python\\myscript.py')
['C:\\Users\\Timothy\\Documents\\Python\\myscript.py']
 shlex.split(r'C:\Users\Timothy\Documents\Python\myscript.py', posix=False)
['C:\\Users\\Timothy\\Documents\\Python\\myscript.py']

The first example shows that single backslashes get removed. The second example 
shows that double backslashes are preserved intact. The third example shows 
that if posix=False, single backslashes are converted to double backslashes. 
None of these three behaviors are acceptable to correctly parse a Windows path, 
which is why I am doing what I am to work around the issue.

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


Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread Ian Kelly
On Wed, May 28, 2014 at 11:32 AM, funky benjaminherna...@gmail.com wrote:
 while done == False:
 for event in pygame.event.get():
 if event.type == pygame.QUIT:
 done == True

Here is one fairly obvious bug; you used == where you presumably
intended to do an assignment.  As it stands it will just compare done
to True and then discard the result.

That's not necessarily the only issue, but if you want more detailed
help then as others have stated you're going to have to tell us in
what way the code isn't working as expected.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-28 Thread ps16thypresenceisfullnessofjoy

Thank you for your replies. I tried what you suggested in your second post and 
it worked.

That was actually a mistake in the app_list.xml file. As you said:

app name=LibreOffice Writer%ProgramFiles%\LibreOffice 4\program\swriter.exe 
C:\Users\Timothy\Documents\myfile.odt/app

should instead be:

app name=LibreOffice Writer%ProgramFiles%\LibreOffice 
4\program\swriter.exe C:\Users\Timothy\Documents\myfile.odt/app

I just made that file as a sample, and didn't actually test it.

My shlex dance has nothing to do with that, though. A few examples from the 
interactive interpreter should explain why I am doing it (I used raw strings in 
these examples so that I wouldn't need to escape the backslashes):

 import shlex
 shlex.split(r'C:\Users\Timothy\Documents\Python\myscript.py')
['C:UsersTimothyDocumentsPythonmyscript.py']
 shlex.split(r'C:\\Users\\Timothy\\Documents\\Python\\myscript.py')
['C:\\Users\\Timothy\\Documents\\Python\\myscript.py']
 shlex.split(r'C:\Users\Timothy\Documents\Python\myscript.py', posix=False)
['C:\\Users\\Timothy\\Documents\\Python\\myscript.py']

The first example shows that single backslashes get removed. The second example 
shows that double backslashes are preserved intact. The third example shows 
that if posix=False, single backslashes are converted to double backslashes. 
None of these three behaviors are acceptable to correctly parse a Windows path, 
which is why I am doing what I am to work around the issue.

I think I'll use PyWin32 as you suggested if it's available on the user's 
system. If it's not, the user will just be required to prefix path-to-script.py 
with python.exe. (When I first asked my question, I was thinking I might just 
need to pass a certain STARTUPINFO flag to subprocess.Popen, but it looks like 
that's not the solution.)

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


passing Python assignment value to shell

2014-05-28 Thread Satish Muthali
Hello Experts,

I am trying to extract the available userspace+swap memory and then want to 
feed this value as an argument to a tool that is executed in the shell.

so, this is what I have so far:

reecalc = [s.split() for s in os.Popen(free -ht).read().splitlines()]
freecalc_total = freecalc[4]
freecalc_total = freecalc_total[3]
freecalc_total = freecalc_total.translate(None, 'M’)

Now I want to feed the value for ‘freecalc_total’ as an argument to a command 
executed by the shell.

For example:

devnull = open(os.devnull, “w”)
runCommand = subprocess.call([“stressapptest”, “I want to pass the value of 
freecalc_total here”, “20”],stdout=devnull,stderr=subprocess.STDOUT)
devnull.close()

How do I go about  doing this?

Many thanks in advance

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


ANN: PyQt v5.3 Released

2014-05-28 Thread Phil Thompson

PyQt5 v5.3 has been released and is available from
http://www.riverbankcomputing.com/software/pyqt/download5.

PyQt5 is a comprehensive set of bindings for v5 of Digia's Qt
cross-platform application framework.  It supports Python v3, v2.7 and
v2.6.

The highlights of this release include support for Qt v5.3 including the
new QtQuickWidgets and QtWebSockets modules.

PyQt5 supports cross-compiling to iOS and Android.

Windows installers are provided which contain everything needed for 
PyQt5
development (including Qt, Qt Designer, QScintilla, and MySQL, 
PostgreSQL,

SQLite and ODBC drivers) except Python itself.  Installers are provided
for the 32 and 64 bit versions of Python v3.4.

PyQt5 is implemented as a set of 29 extension modules including support
for:

- non-GUI infrastructure including event loops, threads, i18n, user and
  application settings, mapped files and shared memory

- GUI infrastructure including window system integration, event 
handling,

  2D graphics, basic imaging, fonts, OpenGL

- a comprehensive set of desktop widgets

- WebKit

- full integration with Quick2 and QML allowing new Quick items to be
  implemented in Python and created in QML

- event driven network programming

- multimedia including cameras, audio and radios

- Bluetooth

- global positioning using satellite, Wi-Fi or text file sources

- sensors including accelerometers, altimeters, compasses, gyroscopes,
  magnetometers, and light, pressure, proximity, rotation and 
temperature

  sensors

- serial ports

- SQL

- printing

- DBus

- XPath, XQuery, XSLT and XML Schema validation

- a help system for creating and viewing searchable documentation

- unit testing of GUI applications.

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


Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread Mark H Harris

On 5/28/14 12:32 PM, funky wrote:

import pygame   ==  a very good place to start
import random
import time
import sys



http://www.pygame.org/wiki/tutorials


My hourly rate is $295.00 /hour, w/2hour minimum,  happy to send you a 
contract of engagement and a copy of my document of understanding.  Sign 
both and arrange payment through paypal and I'll give you a call --- the 
first 30 minutes consultation is free.


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


Re: passing Python assignment value to shell

2014-05-28 Thread John Gordon
In mailman.10422.1401310723.18130.python-l...@python.org Satish Muthali 
satish.muth...@gmail.com writes:

 Now I want to feed the value for 'freecalc_total' as an argument to
 a command executed by the shell.

 For example:

 devnull = open(os.devnull, 'w')
 runCommand = subprocess.call(['stressapptest', 'I want to pass
 the value of freecalc_total here'], stdout=devnull,stderr=subprocess.STDOUT)
 devnull.close()

I think you can just include freecalc_total directly as part of the
argument list, like this:

runCommand = subprocess.call(['stressapptest', freecalc_total], 
stdout=devnull, stderr=subprocess.STDOUT)

-- 
John Gordon Imagine what it must be like for a real medical doctor to
gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'.

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


Python alternative to Google Groups

2014-05-28 Thread Steven Clift
If you are looking for an open source alternative between Google
Groups and Mailman, I wanted to share:

http://groupserver.org

It has recent release and new design.

Key is the assumption that any user can publish/reply via email or the
web, not just receive email alerts for posting via the web.

Our non-profit is a big user and just released our mobile responsive
design - http://forums.e-democracy.org  We are looking to collaborate
with other orgs and developers. Note:
http://e-democracy.org/groupserver

Cheers,
Steven Clift
E-Democracy.org

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


Re: IDE for python

2014-05-28 Thread Ben Finney
Sameer Rathoud sameer.rath...@gmail.com writes:

 I am new to python.
 I am currently using python 3.3

Welcome! You're off to a good start, using Python 3 :-)

 With python I got IDLE, but I am not very comfortable with this.
 Please suggest, if we have any free ide for python development.

What other programming languages are you familiar with?

Learning a programming language is difficult enough. It should *not*
entail all the effort of evaluating and learning a language-specific
IDE; you should already be using an IDE that supports the new language.


I strongly recommend learning *one* IDE which is free software, has good
cross-platform and cross-language support, is mature and flexible.

My IDE is Bash, Screen, and Emacs:

* a terminal, running a GNU Screen session; Screen windows include:

  * Bash in various Screen windows

  * Emacs

  * an automated test runner

  * a database client

You should invest the effort to learn either of Vim or Emacs. They both:

* are free software, ensuring there are no barriers to their continued
  maintenance into the indefinite future;

* mature, ensuring they have survived numerous IDE fads and already
  incorporate a lot of accumulated wisdom;

* cross-platform, working the same on every development operating system
  today;

* cross-language, supporting every important programming language and
  hundreds of minor ones.

Learn either one of them, *once*, and you will be able to use the same
toolset for any other languages you need.

-- 
 \“A free press is one where it's okay to state the conclusion |
  `\  you're led to by the evidence.” —Bill Moyers |
_o__)  |
Ben Finney

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


Re: Python alternative to Google Groups

2014-05-28 Thread Andrew Berg
On 2014.05.28 16:54, Steven Clift wrote:
 If you are looking for an open source alternative between Google
 Groups and Mailman, I wanted to share:
 
 http://groupserver.org
 
 It has recent release and new design.
 
 Key is the assumption that any user can publish/reply via email or the
 web, not just receive email alerts for posting via the web.
This list doesn't use Google Groups directly; Google provides
an interface to comp.lang.python on Usenet, so something like this
would have to be *in addition to* the mailer and Usenet.

-- 
CPython 3.4 | Windows NT 6.2.9200 / FreeBSD 10.0
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 is killing Python

2014-05-28 Thread Ben Finney
Larry Martell larry.mart...@gmail.com writes:

 No company that I work for is using python 3 - they just have too much
 of an investment in a python 2 code base to switch.

There are many large companies still using FORTRAN and COBOL because of
a large investment in those languages, which are far more outdated than
Python 2. What's your point?

 I'm just saying.

Ah, so no point that you're willing to defend, then.

-- 
 \ “Books and opinions, no matter from whom they came, if they are |
  `\ in opposition to human rights, are nothing but dead letters.” |
_o__)  —Ernestine Rose |
Ben Finney

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


Re: Python box (home-use smart router)

2014-05-28 Thread Rhodri James
On Tue, 27 May 2014 08:33:42 +0100, animalize81 animaliz...@gmail.com  
wrote:



Home-use smart router is more and more popular.

If Python Software Foundation embeds Python into such router, and  
develops a framework that has the following features:


1, allow power-down at any time
2, dynamic domain name
3, local storage support (SD cards or Hard Disk)
4, telnet server
etc.

Then we can create micro private server on it.

Still can't see the full prospect, but it may be a great platform for  
people's imagination.


I think Python is very suitable for such role.


Have you met the Raspberry Pi?

Seriously, since many such smart routers are Linux boxes, there's a good  
chance there is already a Python interpreter installed and your list of  
other demands is already met.  It's certainly the case in the boxes I work  
on, and we do use Python for bits of system scripting.  We *don't* use  
Python for application writing because speed and space constraints are  
usually quite tight, which generally means coding in C for preference  
(despite my boss's attempts to force me to use C++).


--
Rhodri James *-* Wildebeest Herder to the Masses
--
https://mail.python.org/mailman/listinfo/python-list


Re: IDE for python

2014-05-28 Thread Rhodri James
On Wed, 28 May 2014 14:04:55 +0100, Steven D'Aprano  
steve+comp.lang.pyt...@pearwood.info wrote:



My IDE is to have three GUI windows open:

* A web browser for searching the Internet. Any browser will do, but I
prefer Firefox.

* A tabbed editor. I prefer kate (KDE 3 version, not KDE 4), but geany is
also good. At a pinch gedit will do. kwrite is another good editor, but
not tabbed, and it lacks some of the features of kate.

* An xterm or console app, again with tabs. I like KDE 3's konsole, but
any modern, configurable, tabbed console will do.


Interesting.  I'm entirely the other way; while I'm perfectly happy to use  
a tabbed browser, I find tabbed editors and tabbed consoles awful to use.   
I want to have three different sections of code side by side on the screen  
for comparison.  I want to have half a dozen consoles all running  
different things, all positioned so I can take in the state of those  
things at a glance.  I do not want to be wasting time flicking between  
this and that, and relying on my relatively poor memory to cache all that  
information :-)


Then again, I'm not as bad as one former colleague of mine.  He reckons  
that the main advantage of higher resolution screens is that he can tile  
more 80x40 console windows on them.


--
Rhodri James *-* Wildebeest Herder to the Masses
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 is killing Python

2014-05-28 Thread Paul Rubin
Ben Finney b...@benfinney.id.au writes:
 There are many large companies still using FORTRAN and COBOL because of
 a large investment in those languages, which are far more outdated than
 Python 2. What's your point?

I think some of us see Python 2 as perfectly fine--we've looked into
Python 3 and found some minor improvements along with some minor
breakage, and figure it's not worth the cognitive burden of switching
from something that already works, even if Python 3 is slightly better
in the scheme of things.  

While I'm sure it will change over time, I currently don't actually know
anyone using Python 3 even for new projects.  I know *of* people using
Python 3 including here on this newsgroup, but I'm currently not
personally acquainted with any of them.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: passing Python assignment value to shell

2014-05-28 Thread Ben Finney
Satish Muthali satish.muth...@gmail.com writes:

 so, this is what I have so far:

Thank you for presenting your code. Please ensure that you post in text
only, without transforming the characters from what you typed.

Something in your message composition process is currently converting
some ‘’ (U+0022 QUOTATION MARK) characters into ‘“’ and ‘”’ (U+201C
LEFT DOUBLE QUOTATION MARK and U+201D RIGHT DOUBLE QUOTATION MARK)
characters, which changes the meaning of your code. Best to turn off all
such automated conversions when you compose a message.

 reecalc = [s.split() for s in os.Popen(free -ht).read().splitlines()]
 freecalc_total = freecalc[4]
 freecalc_total = freecalc_total[3]
 freecalc_total = freecalc_total.translate(None, 'M’)

 Now I want to feed the value for ‘freecalc_total’ as an argument to a
 command executed by the shell.

It will need to be a text string representation of that number, since
the command line will be a sequence of text string arguments.

To create a text string representation of an integer, use
‘str(freecalc_total)’. (In Python 2, use ‘unicode(freecalc_total)’.)

If the number is not an integer, you should format it explicitly with a
format string URL:https://docs.python.org/3/library/functions.html#format::

 freecalc_total = 80752.16
 freecalc_arg = format(freecalc_total, 14.3f)
 freecalc_arg
' 80752.160'

 For example:

 devnull = open(os.devnull, “w”)
 runCommand = subprocess.call([“stressapptest”, “I want to pass the value of 
 freecalc_total here”, “20”],stdout=devnull,stderr=subprocess.STDOUT)
 devnull.close()

(You should follow PEP 8 for your Python code, which recommends against
camelCaseNames and recommends spaces after commas for readability.)

So I'd suggest::

freecalc_total = your_computations_as_above()
foo_arg = 20# You don't tell us what this argument is, but it should 
have a name.
command_args = [
stressapptest,
str(freecalc_total), str(foo_arg)]
process = subprocess.call(
command_args, stdout=devnull, stderr=subprocess.STDOUT)

 Many thanks in advance

I hope that helps.

-- 
 \   “Homer, where are your clothes?” “Uh... dunno.” “You mean Mom |
  `\dresses you every day?!” “I guess; or one of her friends.” |
_o__)—Lisa  Homer, _The Simpsons_ |
Ben Finney

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


Re: Python alternative to Google Groups

2014-05-28 Thread Ben Finney
Steven Clift s...@publicus.net writes:

 If you are looking for an open source alternative between Google
 Groups and Mailman, I wanted to share:

 http://groupserver.org

 It has recent release and new design.

Thanks. For many of us, an important service is NNTP, offered by GMane
and others.

I think I'm unlikely to try GroupServer unless it also offers an NNTP
interface to forums, allowing me to integrate them into my existing
interface (intead of needing to visit yet another web site).

You can implement an NNTP interface to the GroupServer groups, by
following RFC 3977 URL:https://tools.ietf.org/html/rfc3977. The
Papercut project URL:http://pessoal.org/papercut/ produces an NNTP
server in Python, released as free software.

 Our non-profit is a big user and just released our mobile responsive
 design - http://forums.e-democracy.org  We are looking to collaborate
 with other orgs and developers. Note:
 http://e-democracy.org/groupserver

Great! Thanks for letting us know.

-- 
 \   “Anything that we scientists can do to weaken the hold of |
  `\religion should be done and may in the end be our greatest |
_o__)  contribution to civilization.” —Steven Weinberg |
Ben Finney

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


Forking PyPI package

2014-05-28 Thread Wiktor
Hello.

  There's script pwdhash https://pypi.python.org/pypi/pwdhash.py/0.1.1,
which I always* wanted to port to Python 3. (* - well, i.e. 6 months ;-))
  I'm using this hashing algorithm quite often for years in my browser
(Opera plugin), so I thought that it would be cool to have it as python
script.

  It took me some time to make it work under Python 3, because I knew
nothing about str - bytes encoding, and this was biggest issue why
original script wasn't Py3 compatible. So now my version works, it even
supports Unicode characters (original JS script does that, but pwdhash.py
script doesn't), and now I'm planning to do simple GUI version, because
copying from console isn't very comfortable (and I couldn't find good [os
and other packages independent] solution to copy string to clipboard. Best
answer from here http://goo.gl/8V9Ba6 isn't working).
  So, my point is, I think maybe it would be useful also to others.

  I'm newbie not only to Python, but to programming in general, so I don't
know, what is best practice in OS programming community. How forking works.
How py2-py3 porting (by 3rd person) is realized in Pythonians community.
Can you suggest me something? I see few scenarios:

1) I'm trying to contact with original script's author, and send him my
propositions of changes in code. (Oh, one more thing: my code isn't
backward compatible, and I don't know Py2 that much to include all those
try/except, so it could be Py2+Py3 compatible). He decides, if he wants to
release it as Py3 only version, or combine it with his script and release
Py2+Py3 common version.

2) I'm not contacting with him, and I'm forking his project on GitHub
   a) under the same name? - probably bad idea
   b) under new name (e.g. py3pwdhash)? 
Of course all credits about original author stay in code / setup.py.

2.1) After forking on GitHub, I'm creating new package on PyPI
   a) under old name, but different version number, and new description?
   b) under new name, to not confuse users?
   
   
  So, what should I do?
  I know, that maybe I shouldn't touch that script in first place and just
mail to author Hey, would you please port it to Py3?, but I also treated
it as programming exercise, and I didn't think about consequences. ;-) 

TIA
-- 
Best regards, Wiktor Matuszewski
'py{}@wu{}em.pl'.format('wkm', 'ka')
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 is killing Python

2014-05-28 Thread Terry Reedy

On 5/28/2014 3:23 PM, Larry Martell wrote:

Somthing I came across in my travels through the ether:

https://medium.com/@deliciousrobots/5d2ad703365d/


Claim: Python 3 languishes in disuse.

Fact: in 2013, there were around 14 million downloads of windows 
installers for each of 2.7.x and 3.3.x. 3.3 is over twice as popular as 
3.2 (to be expected).

http://article.gmane.org/gmane.comp.python.devel/147822
In a year, we will see about 3.4.

Regardless of comparisons with 2.7, 3.3 is a success in absolute numbers.

Claim: Another great strength of Python 2 was that programs written in 
it would almost always run on the next version of Python without much 
alteration.


True. Changes and removals of deprecated features (like old style 
classes) were put off until 3.0 (at the request of some of the noiser 
users). Some improvements were relegated to future imports. By 2.7, the 
load of accumulated 'technological debt' was as much as the developers 
wanted to deal with, over and over.


--
Terry Jan Reedy

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


Re: IDE for python

2014-05-28 Thread Greg Schroeder
On Wed, 2014-05-28 at 22:55 +1000, Chris Angelico wrote:
 On Wed, May 28, 2014 at 9:46 PM, Greg Schroeder gmschroe...@gmail.com wrote:
   Please suggest, if we have any free ide for python development.
 
  Anything that writes text is fine.
  I recommend the standard text editor for your OS (Notepad if you use
  Windows, Textedit on Mac, whatever is on your GNU/Linux distro by
  default) unless you know exactly what you don't like about it.
 
 No. Don't use Notepad for anything! It's easy enough to get a better
 editor. Among its other faults, Notepad:
 
 1) Has problems with LF line endings (they vanish, and you have hugely
 long lines)
 2) Puts three junk bytes onto the beginning of a file that it
 considers saved as UTF-8
 3) Doesn't understand coding cookies, and will happily save something
 in a different encoding like CP-1252 (which it calls ANSI)
 4) Guesses encodings on load, giving rise to the famous Bush hid the
 facts trick - although this is unlikely to be a problem with
 something of decent size
 5) Has issues with large files - or at least, it did last time I
 tried; this may no longer be true with Windows 7/8
 
 Default text editors on the Linux distros I've used have been far
 better, but still less than ideal. With Debian Squeeze, I got a gedit
 that bugged me in several ways, which is what pushed me onto SciTE.
 You can certainly start coding with gedit, though. The issues that I
 had with it were relating to heavy-duty usage that I do, where I'm
 basically spending an entire day delving into code and moving stuff
 around. These days, though, I'd rather have one editor on both the
 platforms I use (Windows and Linux, each in multiple variants), as it
 allows me to share configs and comfortable keystrokes. There are
 plenty of cross-platform editors to choose from.
 
 So, I agree with your analysis, as regards gedit (know exactly what
 you don't like about it). If it doesn't bug you, use it. But if
 Notepad doesn't bug you, *still don't use it*, because it's like
 driving a car that isn't structurally sound. It might not be you that
 gets hurt by it... or it might not be for quite a while that you see
 the problems... but the pain will happen.
 
 ChrisA
Well, learn something new every day. Any gripes against vim with some
tweaks?
Greg


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


daemon thread cleanup approach

2014-05-28 Thread Carl Banks
Ok, so I have an issue with cleaning up threads upon a unexpected exit.  I came 
up with a solution but I wanted to ask if anyone has any advice or warnings.

Basically I am writing a Python library to run certain tasks.  All of the calls 
in the library start worker threads to do the actual work, and some of the 
worker threads are persistent, others not.  Most threads have cleanup work to 
do (such as deleting temporary directories and killing spawned processes).

For better or worse, one of the requirements is that the library can't cause 
the program to hang no matter what, even if it means you have to forego cleanup 
in the event of an unexpected exit.  Therefore all worker threads run as 
daemons.  Nevertheless, I feel like the worker threads should at least be given 
a fair opportunity to clean up; all threads can be communicated with and asked 
to exit.

One obvious solution is to ask users to put all library calls inside a 
with-statement that cleans up on exit, but I don't like it for various reasons.
Using atexit doesn't work because it's called after the daemon threads are 
killed.

Here's the solution I came up with: in the library's init function, it will 
start a non-daemon thread that simply joins the main thread, and then asks all 
existing worker threads to exit gracefully before timing out and leaving them 
to be killed.  So if an exception ends the main thread, there is still a chance 
to clean up properly.

Does anyone see a potential problem with this approach?  It it possible that 
this will cause the program to hang in any case?  We can assume that all calls 
to the library will occur from the main thread, or at least from the same 
thread.  (If that isn't the case, then the caller has taken responsibility to 
ensure the program doesn't hang.)

This is Python 2.7, and it's only ever going to run on Windows.

Thanks for any advice/warnings.

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


Re: Python 3 is killing Python

2014-05-28 Thread Terry Reedy

On 5/28/2014 3:49 PM, Paul Rubin wrote:

Larry Martell larry.mart...@gmail.com writes:

Somthing I came across in my travels through the ether:
[1]https://medium.com/@deliciousrobots/5d2ad703365d/


Python 3 can revive Python https://medium.com/p/2a7af4788b10


This makes the same false claim It’s not like anyone is using Python 3 
anyway, (so go ahead and bread existing Py3 code. At least some of the 
20+ million windows downloads must be in use.



   long HN comment thread: https://news.ycombinator.com/item?id=7801834


One legitimate request is better installation of dependencies, which is 
in progress. This is not a 2 versus 3 issue, unless there are 3-only 
improvement.


Some want concurrency primitives like go has. Guido went for a new 
module instead. I don't know what the importand differences are.


Some want a better REPL, including color. The Idle shell already has the 
syntax colorizing. I don't know what else might have been meant.



Python 3 is fine http://sealedabstract.com/rants/python-3-is-fine/


In my opinion, about the best non-developer blog on Python 3 -- by a 
sensible, satisfied user. in March 2014 Python 3 downloads overtook 
Python 2 downloads by a healthy margin 54% vs 46%. OK, that was boosted 
by the release of 3.4. But the point still stands.


--
Terry Jan Reedy


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


Re: Forking PyPI package

2014-05-28 Thread Terry Reedy

On 5/28/2014 8:31 PM, Wiktor wrote:

Hello.

   There's script pwdhash https://pypi.python.org/pypi/pwdhash.py/0.1.1,
which I always* wanted to port to Python 3. (* - well, i.e. 6 months ;-))
   I'm using this hashing algorithm quite often for years in my browser
(Opera plugin), so I thought that it would be cool to have it as python
script.

   It took me some time to make it work under Python 3, because I knew
nothing about str - bytes encoding, and this was biggest issue why
original script wasn't Py3 compatible. So now my version works, it even
supports Unicode characters (original JS script does that, but pwdhash.py
script doesn't), and now I'm planning to do simple GUI version, because
copying from console isn't very comfortable (and I couldn't find good [os
and other packages independent] solution to copy string to clipboard. Best
answer from here http://goo.gl/8V9Ba6 isn't working).
   So, my point is, I think maybe it would be useful also to others.

   I'm newbie not only to Python, but to programming in general, so I don't
know, what is best practice in OS programming community. How forking works.
How py2-py3 porting (by 3rd person) is realized in Pythonians community.
Can you suggest me something? I see few scenarios:

1) I'm trying to contact with original script's author, and send him my
propositions of changes in code. (Oh, one more thing: my code isn't
backward compatible, and I don't know Py2 that much to include all those
try/except, so it could be Py2+Py3 compatible). He decides, if he wants to
release it as Py3 only version, or combine it with his script and release
Py2+Py3 common version.

2) I'm not contacting with him, and I'm forking his project on GitHub
a) under the same name? - probably bad idea
b) under new name (e.g. py3pwdhash)?
Of course all credits about original author stay in code / setup.py.

2.1) After forking on GitHub, I'm creating new package on PyPI
a) under old name, but different version number, and new description?
b) under new name, to not confuse users?


   So, what should I do?
   I know, that maybe I shouldn't touch that script in first place and just
mail to author Hey, would you please port it to Py3?, but I also treated
it as programming exercise, and I didn't think about consequences. ;-)


Check the license of the code *and* contact the author if possible.

--
Terry Jan Reedy

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


Programmer's text editor, for Python and everything else (was: IDE for python)

2014-05-28 Thread Ben Finney
Greg Schroeder gmschroe...@gmail.com writes:

 Any gripes against vim with some tweaks?

None from me; Vim is a fine programming (and programmable) editor.

It is free software, like Python. This is vital for any tool in which
one expects to sink an amount of effort. It means no party has
privileged access to change it, which ensures that (unlike proprietary
software) it will never be held hostage to one party's disinterest or
whim.

It works the same way on all important operating systems today that
programmers will use to write programs. This is, of course, a result of
it being free software; anyone motivated to improve the software on a
particular platform has full freedom to do so, and return the
improvements to the community.

It is mature and highly flexible, both of which mean it can handle any
important programming task once someone puts in the effort to configure
it. And it has a thriving community, which means most of what you want
customised has already been done by others.

It supports a massive range of text editing tasks, most of which you
don't need to know but will be there when your programming tasks expand
as they inevitably do. You won't need to re-learn another tool, but only
a plug-in for your existing text editor.


All of the above are true for Vim and Emacs, which is why I strongly
recommend learning one of them well and using it for all the editing you
do while programming.

URL:https://wiki.python.org/moin/Vim
URL:http://blog.dispatched.ch/2009/05/24/vim-as-python-ide/

URL:https://wiki.python.org/moin/EmacsEditor
URL:http://www.enigmacurry.com/2008/05/09/emacs-as-a-powerful-python-ide/

-- 
 \   “When a well-packaged web of lies has been sold to the masses |
  `\over generations, the truth will seem utterly preposterous and |
_o__)its speaker a raving lunatic.” —Dresden James |
Ben Finney

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


Re: How to run script from interpreter?

2014-05-28 Thread Steven D'Aprano
On Wed, 28 May 2014 11:39:23 -0500, Mark H Harris wrote:

 On 5/28/14 2:44 AM, onlyvin...@gmail.com wrote:
 On Friday, January 19, 2001 1:22:23 AM UTC+5:30, Rolander, Dan wrote:
 What is the best way to run a python script from within the
.
 interpreter? What command should I use?


 try using execfile(filename)


 What type of script?  python?  bash?   tcl?   other?

Most Python scripts are Python. The remainder are usually Python.


 If you want to use python as a shell-glue you can try using system.
 
   from os import system
   def function_name([parms])
    blah blah
    rc = system(your_script_name)


os.system is cool for quick and dirty calls to an external command. But 
for serious work, the subprocess module is better.



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


Re: Python 3 is killing Python

2014-05-28 Thread Steven D'Aprano
On Wed, 28 May 2014 14:58:05 -0500, Larry Martell wrote:

 On Wed, May 28, 2014 at 2:49 PM, Paul Rubin no.email@nospam.invalid
 wrote:
 
 Larry Martell larry.mart...@gmail.com writes:
  Somthing I came across in my travels through the ether:
  [1]https://medium.com/@deliciousrobots/5d2ad703365d/

 Python 3 can revive Python https://medium.com/p/2a7af4788b10
   long HN comment thread: https://news.ycombinator.com/item?id=7801834

 Python 3 is fine http://sealedabstract.com/rants/python-3-is-fine/

 OT: wow that medium site is obnoxious.


 No company that I work for is using python 3 - they just have too much
 of an investment in a python 2 code base to switch. I'm just saying.

Is that Python 2 code base aimed at Python 2.7 or 2.6? Or 2.5? Or 2.4? Or 
even 2.3? Or all of the above?

One of the most pernicious myths about this is that there is one single 
Python 2 ecosystem. There isn't. The company I work for is stuck with 2.6 
for the foreseeable future, because that's the version of Python provided 
by the OS of choice. I recently migrated a client's code base from 2.3 to 
2.6, and they will likely stay with 2.6 forever. And I know of at least 
one company who is using Python 1.5 (yes, 1.5) and have no plans to 
migrate. 1.5 works for them, and they apparently don't need or don't care 
about security updates, so why should they migrate?

This is all good. If 2.x works for your application, and you don't care 
about all the awesome new features in 3.3+, don't care about bug fixes 
and security updates, and don't mind being stuck with a version of Python 
that will slowly but surely become more and more obsolete, more power to 
you.

The Python core developers have recent committed to providing security 
updates for 2.7 until 2020. And Redhat have paid support for 2.7 until 
2023. So there's no rush.

But anyone who makes that decision to stay with 2.x forever is in the 
same position as those who stay with 1.5 forever. Eventually, you'll have 
no OS support, no vendor support, no security updates, no bug fixes, it 
will become harder and harder to find programmers who know that 
particular version of the language, and even harder to find third party 
libraries that support it, training new staff in the obsolete version 
will be hard because all the books and tutorials will be written for more 
recent versions...

My prediction is:

- over the next three or four years, there will be a steady trickle of 
people complaining about Python 3, slowly fading as more people move to 
Python 3;

- when the main Linux distros start using Python 3 as their system 
Python, there will be a sudden rush of people to Python 3;

- about six months before Python 2 drops out of free support, there will 
be a sudden flood of panicky cries for help from people who didn't bother 
making a *single* step towards migration over the previous ten years, and 
suddenly realise that they need to migrate yesterday.



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


Re: Python 3 is killing Python

2014-05-28 Thread Stefan Behnel
Terry Reedy, 29.05.2014 02:41:
 On 5/28/2014 3:23 PM, Larry Martell wrote:
 Somthing I came across in my travels through the ether:

 https://medium.com/@deliciousrobots/5d2ad703365d/
 
 Claim: Python 3 languishes in disuse.
 
 Fact: in 2013, there were around 14 million downloads of windows installers
 for each of 2.7.x and 3.3.x.

That can be explained. All those Python 3 downloads can clearly only come
from automatic get me the latest version downloaders, and when the users
realise that they got the totally wrong Python, they'll end up downloading
Py2.7 additionally. Thus, the download numbers for Py2 can obviously never
drop substantially below those of Py3, minus those users who give up after
the first try already (which explains the exception around the time Py3.4
came out).

I propose to rename Python 3.x to 1.7.x to prevent users from falling into
that evil trap. That will also make it clear again which Python is expected
to prevail in the long run.

Stefan :o)


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


Re: Python 3 is killing Python

2014-05-28 Thread Steven D'Aprano
On Wed, 28 May 2014 20:41:53 -0400, Terry Reedy wrote:

 Claim: Another great strength of Python 2 was that programs written in
 it would almost always run on the next version of Python without much
 alteration.
 
 True. 

True, but only because of the weasel-words almost always, and without 
much alteration.

And for the record, for many (although not all) programs written in 
Python 2.7, it is still true that they will often run in Python 3 with 
little or no modification.


 Changes and removals of deprecated features (like old style
 classes) were put off until 3.0 (at the request of some of the noiser
 users). 

That's a little unfair. Noisy users or not, Python Dev has always taken 
backwards compatibility seriously.

Nevertheless, there have been some big changes to Python 2.x that 
*didn't* wait for 3.x to break backwards compatibility. A few examples 
that come to mind:

- removing string exceptions for good in 2.6;
- changes to the treatment in hex() of negative numbers;
- the repr() of floats;
- changes to the sequence of random numbers generated by the
  random number module (e.g. while random.random() is 
  guaranteed to return the same sequence of values, 
  random.choice is not);
- removal of obsolete modules like bastion and rotor.


Any and all of these things can break code that relies on them.




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


Re: Python 3 is killing Python

2014-05-28 Thread Paul Rubin
Steven D'Aprano st...@pearwood.info writes:
 The Python core developers have recent committed to providing security 
 updates for 2.7 until 2020. And Redhat have paid support for 2.7 until 
 2023. So there's no rush.

Perhaps Python 4 will be out by then and the Python 2 holdouts can skip
over Python 3.

 - over the next three or four years, there will be a steady trickle of 
 people complaining about Python 3, slowly fading as more people move to 
 Python 3;
 - when the main Linux distros start using Python 3 as their system 
 Python, there will be a sudden rush of people to Python 3;

This is more realistic--people don't explicitly switch but rather the
stuff that comes with the OS changes.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: passing Python assignment value to shell

2014-05-28 Thread Satish Muthali
Hello Experts,

I was able to figure this out after spending time reading the Python help docs.

This is what I went about doing:


 reecalc = [s.split() for s in os.Popen(free -ht).read().splitlines()]
 freecalc_total = freecalc[4]
 freecalc_total = freecalc_total[3]
 freecalc_total = freecalc_total.translate(None, 'M’)

   tmp = %s % freecalc_total
  command = stressapptest -M %s -s 20 % tmp
  p = subprocess.Popen(command, shell=True,  stdout=subprocess.PIPE, 
stderr=subprocess.PIPE).communicate()[0]
…
…
...

Please let me know if this is the optimal method to achieve in order to pass 
the assignment value to shell. I am open to suggestions or a better way of 
implementation/logic.

Thanks again

Satish

On May 28, 2014, at 1:16 PM, Satish Muthali satish.muth...@gmail.com wrote:

 Hello Experts,
 
 I am trying to extract the available userspace+swap memory and then want to 
 feed this value as an argument to a tool that is executed in the shell.
 
 so, this is what I have so far:
 
 reecalc = [s.split() for s in os.Popen(free -ht).read().splitlines()]
 freecalc_total = freecalc[4]
 freecalc_total = freecalc_total[3]
 freecalc_total = freecalc_total.translate(None, 'M’)
 
 Now I want to feed the value for ‘freecalc_total’ as an argument to a command 
 executed by the shell.
 
 For example:
 
 devnull = open(os.devnull, “w”)
 runCommand = subprocess.call([“stressapptest”, “I want to pass the value of 
 freecalc_total here”, “20”],stdout=devnull,stderr=subprocess.STDOUT)
 devnull.close()
 
 How do I go about  doing this?
 
 Many thanks in advance
 
 -Satish

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


Re: Python alternative to Google Groups

2014-05-28 Thread Tim Golden

On 28/05/2014 22:54, Steven Clift wrote:

If you are looking for an open source alternative between Google
Groups and Mailman, I wanted to share:

 http://groupserver.org

It has recent release and new design.


Aargh. I hate it when someone does that: posts something so interesting 
that I want to dive in and start investigating, when I *know* I'm 
already overcommitted to everything else I'm already doing!


On a more serious note, it does look interesting and it would be great 
to have a credible alternative to promote for people who tend towards 
GG. Needs to someone to do the setup / config / management though. 
(Hence my frustrated comment above).



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


Re: passing Python assignment value to shell

2014-05-28 Thread Cameron Simpson

On 28May2014 21:48, Satish Muthali satish.muth...@gmail.com wrote:

This is what I went about doing:

   reecalc = [s.split() for s in os.Popen(free -ht).read().splitlines()]


I think you dropped an f in your cut/paste. Try to be precise.


   freecalc_total = freecalc[4]
   freecalc_total = freecalc_total[3]
   freecalc_total = freecalc_total.translate(None, 'M )


This is syntacticly invalid. Did this really come from working code?
Also, .translate does not accept None as its first argument.


  tmp = %s % freecalc_total


If freecalc_total is a string (as it seems from the above) then this line does 
nothing.


If freecalc_total were a number, it would probably be better to use %d 
instead of %s; %d will emit an error if freecalc_total is not a number, a 
useful sanity check.



 command = stressapptest -M %s -s 20 % tmp
 p = subprocess.Popen(command, shell=True,  stdout=subprocess.PIPE, stderr=
subprocess.PIPE).communicate()[0]

Please let me know if this is the optimal method to achieve in order to pass
the assignment value to shell. I am open to suggestions or a better way of
implementation/logic.


It is better to avoid shell=True unless you really need to run a shell command 
(shell syntax or control structures, etc). This is because by plonking %s in 
the middle of your shell string, you leave yourself open to injection 
accidents (or attacks, of you can be tricked in the values you substitute).


Since you are running a command with known arguments and no shell syntax, you 
do not need the shell. So just construct the arguments directly:


  [ stressapptest, -M, str(freecalc_total), -s, 20 ]

and set shell=False.

Cheers,
Cameron Simpson c...@zip.com.au
--
https://mail.python.org/mailman/listinfo/python-list


Re: daemon thread cleanup approach

2014-05-28 Thread Miki Tebeka
Greetings,

 Ok, so I have an issue with cleaning up threads upon a unexpected exit. 
What do you mean by unexpected exit? Uncaught exception? SIGTERM? ...

 Using atexit doesn't work because it's called after the daemon threads are 
 killed.
I don't follow. Who is killing the daemon threads?

 ...
 It it possible that this will cause the program to hang in any case? 
If due to a bug in the cleanup thread it hangs - the program will hang as well.

All the best,
--
Miki
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue21197] venv does not create lib64 directory and appropriate symlinks

2014-05-28 Thread Vinay Sajip

Vinay Sajip added the comment:

Issue #18807 relates to symlinks not being available, or not being wanted by 
the user creating the environment. The lib64 symlink is (currently) the only 
case where we symlink to a directory (in the other cases, such as aliases for 
the interpreter, we can use copies rather than symlinks). I propose to make a 
change such that if copying rather than symlinking is specified, the lib64 link 
simply isn't created - a copy would be of no use here.

--

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ce1b8b2ddf07 by Vinay Sajip in branch '3.4':
Issue #18807: If copying (no symlinks) specified for a venv, then the python 
interpreter aliases (python, python3) are now created by copying rather than 
symlinking.
http://hg.python.org/cpython/rev/ce1b8b2ddf07

New changeset f2adaccc13ab by Vinay Sajip in branch 'default':
Issue #18807: Merged fix from 3.4.
http://hg.python.org/cpython/rev/f2adaccc13ab

--

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2014-05-28 Thread Vinay Sajip

Vinay Sajip added the comment:

I've made the change - not exactly the same as your patch, which was missing an 
os.chmod() and doing an unnecessary os.path.join() - but thanks for submitting 
a patch :-).

However, note that on 64-bit Linux systems (actually any POSIX other than OS X) 
a symlink lib64 - lib is still created. Perhaps this could be omitted, but I'm 
not sure if that would cause problems with pip. I've posted a note on the 
relevant issue - #21197.

--

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



[issue21591] exec(a, b, c) not the same as exec a in b, c in nested functions

2014-05-28 Thread Robert Jordens

New submission from Robert Jordens:

According to the documentation the exec a in b, c is equivalent to exec(a, 
b, c). But in the testcase below the tuple form causes a SyntaxError while the 
statement form works fine.


diff -r e770d8c4291c Lib/test/test_compile.py
--- a/Lib/test/test_compile.py  Tue May 27 03:30:44 2014 -0400
+++ b/Lib/test/test_compile.py  Wed May 28 02:45:31 2014 -0600
@@ -90,6 +90,22 @@
 with self.assertRaises(TypeError):
 exec(a = b + 1, g, l) in g, l
 
+def test_nested_qualified_exec(self):
+# Can use qualified exec in nested functions.
+code = [
+def g():
+def f():
+if True:
+exec  in {}, {}
+, 
+def g():
+def f():
+if True:
+exec(, {}, {})
+]
+for c in code:
+compile(c, code, exec)
+
 def test_exec_with_general_mapping_for_locals(self):
 
 class M:


SyntaxError: unqualified exec is not allowed in function 'f' it is a nested 
function (code, line 5)

--
components: Interpreter Core
messages: 219259
nosy: Robert.Jordens
priority: normal
severity: normal
status: open
title: exec(a, b, c) not the same as exec a in b, c in nested functions
type: behavior
versions: Python 2.7

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6e2833ae1718 by Serhiy Storchaka in branch '2.7':
Issue #10203: sqlite3.Row now truly supports sequence protocol.  In particular
http://hg.python.org/cpython/rev/6e2833ae1718

New changeset 6af865f1a59d by Serhiy Storchaka in branch '3.4':
Issue #10203: sqlite3.Row now truly supports sequence protocol.  In particulr
http://hg.python.org/cpython/rev/6af865f1a59d

New changeset 474c97a5f0c8 by Serhiy Storchaka in branch 'default':
Issue #10203: sqlite3.Row now truly supports sequence protocol.  In particulr
http://hg.python.org/cpython/rev/474c97a5f0c8

--
nosy: +python-dev

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Claudiu for your contribution.

But please be more careful, your patches contained trailing whitespaces.

Thank you Paul for your report.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue21208] Change default behavior of arguments with type bool when options are specified

2014-05-28 Thread Karl Richter

Karl Richter added the comment:

@paul.j3 That's interesting [1]. Documenting argparse.register seems crucial to 
me (- reopen or file a new request?). 

After dealing more with the very sophisticated and complex functionality of 
argparse I'm sure that this is the only use case where such an unintuitive 
result may happen, so it's worth adding an explicit negative example in the 
docs of argparse.add_argument with a hint to the docs about way that argparse 
handles types.

--
[1] (and a very good example for missing capabilities of QA sites with regard 
to the relation of votes of your much better answer and the one with the 
highest number of votes)

--

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



[issue5950] Make zipimport work with zipfile containing comments

2014-05-28 Thread Thomas Heller

Thomas Heller added the comment:

 As for progress, the answer is no as the hope is to eventually replace
 zipimport with something in pure Python thanks to importlib.

Does this mean there is no chance to put this into 3.4 and 3.3, do we really 
have to wait until 3.5 with it's pure-python zipimport?

I (together with the py2exe-users) have the same usecase as Ryan Kelly in 
msg110014:

 I want to digitally sign a frozen python program with appended zipfile,
 which involves appending the signature to the EXE.  Simple to do if
 only zipimport would support appended comments.

--
nosy: +theller

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



[issue20430] Make argparse.SUPPRESS work as an argument dest

2014-05-28 Thread jzwinck

jzwinck added the comment:

Yes, I have a practical need for dest=SUPPRESS.  One of the reasons is 
basically what you said: to implement things analogous to --help.  In those 
cases you want to be able to invoke a function (e.g. via type=myfunc) but not 
store anything.  Or you may need to ignore an argument completely for 
compatibility, but you have logic which expects all the arguments returned by 
parse_args() to be known and meaningful.  In any case, I wrote this ticket 
because I ran into a concrete need that argparse didn't readily support (which 
almost never happens!).

As for what the usage statement should show: it should behave as if 
dest=SUPPRESS were not present.  If metavar is specified, use that, otherwise 
use the option name as if dest were not passed in.  And we already have the 
behavior that help=SUPPRESS will hide it from the usage entirely, so that 
should still work (i.e. dest=SUPPRESS, help=SUPPRESS should hide the option 
both from --help and the result of parse_args()).

--

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



[issue21592] Make statistics.median run in linear time

2014-05-28 Thread Thomas Dybdahl Ahle

New submission from Thomas Dybdahl Ahle:

The statistics module currently contains the following comment:

FIXME: investigate ways to calculate medians without sorting? Quickselect?

This is important, because users expect standard library functions to use state 
of the art implementations, and median by sorting has never been that.

There are many good linear time alternatives, the classical median-of-k 
algorithm was posted to the mailing list in a nice version by David Eppstein in 
2002 [1]. The fastest method in practice is probably Quick Select in the 
Floyd-Rivest version [2] which is similar to quick sort.

These algorithms also have the feature of letting us select any k-th order 
statistic, not just the median. This seems conceptually a lot simpler than the 
current median/median_low/median_high split.

However, sticking with the current api, a new implementation would have to 
support calculating a median as the average of n//2 and (n+1)//2'th order 
statistics. This could be implemented either by calling the select function 
twice, or by implementing a multi-select algorithm, which is also a well 
studied problem [3].

I'll be happy to contribute code, or help out in any other way.

[1]: https://mail.python.org/pipermail/python-list/2002-May/132170.html
[2]: https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm
[3]: 
https://domino.mpi-inf.mpg.de/intranet/ag1/ag1publ.nsf/0/59C74289A2291143C12571C30017DEA8/$file/Mehlhorn_a_2005_o.pdf

--
components: Library (Lib)
messages: 219265
nosy: Thomas.Dybdahl.Ahle
priority: normal
severity: normal
status: open
title: Make statistics.median run in linear time
type: performance
versions: Python 3.4, Python 3.5

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



[issue21592] Make statistics.median run in linear time

2014-05-28 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
nosy: +steven.daprano
stage:  - needs patch

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



[issue5950] Make zipimport work with zipfile containing comments

2014-05-28 Thread Brett Cannon

Brett Cannon added the comment:

I actually stopped development of a pure Python zip importer so it won't be in 
Python 3.5 either (http://bugs.python.org/issue17630). The motivation simply 
wasn't there if zipimport is going to be sticking around for bootstrapping 
reasons. This can still get fixed in 3.5 (3.4 is Larry's call).

I have added Thomas Wouters and Greg Smith who have done the most work with 
zipimport to the nosy list to see if they have interest in taking a look at the 
patch.

--
nosy: +gregory.p.smith, twouters

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



[issue5950] Make zipimport work with zipfile containing comments

2014-05-28 Thread Peter Otten

Changes by Peter Otten __pete...@web.de:


--
nosy: +peter.otten

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



[issue3015] tkinter with wantobjects=False has been broken for some time

2014-05-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c69e8ea3bf10 by Serhiy Storchaka in branch 'default':
Issue #3015: _tkinter.create() now creates tkapp object with wantobject=1 by
http://hg.python.org/cpython/rev/c69e8ea3bf10

--

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



[issue3015] tkinter with wantobjects=False has been broken for some time

2014-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Lita Cho, originally reported issue is fixed.

I asked Martin (and Guilherme if he is here). Are you agree to close this 
issue? See issue21585 about extending testing.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3015
___
___
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-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

OK, O_TMPFILE is not related. But Windows is related.

--

___
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



[issue21593] Clarify re.search documentation first match

2014-05-28 Thread Joshua Landau

New submission from Joshua Landau:

The documentation for re.search does not state that it returns the first match. 
This should be added, or a clarification added if this is 
implementation-defined.

https://docs.python.org/3/library/re.html#re.search

---

See also

http://stackoverflow.com/questions/23906400/is-regular-expression-search-guaranteed-to-return-first-match

--
assignee: docs@python
components: Documentation
messages: 219270
nosy: Joshua.Landau, docs@python
priority: normal
severity: normal
status: open
title: Clarify re.search documentation first match
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue21592] Make statistics.median run in linear time

2014-05-28 Thread Thomas Dybdahl Ahle

Thomas Dybdahl Ahle added the comment:

I have written some proof of concept code here [1], I would appreciate you 
commenting on it, before I turn it into a patch, as I haven't contributed code 
to Python before.

I have tried to write it as efficiently as possible, but it is of course 
possible that the c-implemented `sorted()` code will be faster than even the 
smartest python-implemented select.

[1]: http://pastebin.com/30x0j39a

--

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum

Changes by Guido van Rossum gu...@python.org:


--
Removed message: http://bugs.python.org/msg219253

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Terry J. Reedy

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


--
Removed message: http://bugs.python.org/msg219255

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum

Guido van Rossum added the comment:

If you don't know enough about the base class you shouldn't be subclassing it. 
In this particular case you should be overriding __init__, not __new__.

--

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



  1   2   >