Re: bash command, get stdErr

2011-08-26 Thread Tracubik
Il Thu, 25 Aug 2011 01:52:25 -0700, Chris Rebert ha scritto: > On Thu, Aug 25, 2011 at 1:25 AM, Tracubik wrote: >> Hi all! cut > Untested: > > from subprocess import Popen, PIPE sudo = Popen("sudo las", shell=True, > stderr=PIPE) > tee = Popen(["tee", "/dev/stderr"], stdin=sudo.stderr, stdout=

Re: bash command, get stdErr

2011-08-26 Thread Chris Rebert
On Fri, Aug 26, 2011 at 12:56 AM, Tracubik wrote: > Il Thu, 25 Aug 2011 01:52:25 -0700, Chris Rebert ha scritto: >> On Thu, Aug 25, 2011 at 1:25 AM, Tracubik wrote: >>> Hi all! > > cut > >> Untested: >> >> from subprocess import Popen, PIPE sudo = Popen("sudo las", shell=True, >> stderr=PIPE) >>

Re: bash command, get stdErr

2011-08-26 Thread Tracubik
Il Thu, 25 Aug 2011 08:25:59 +, Tracubik ha scritto: > Hi all! > i'ld like to execute via Python this simple bash command: > > sudo las > > las is intended to be a typo for "ls" > > the point is that i want to see in the terminal the stderr message (that > is "sorry, try again" if i insert

How to handle application level errors

2011-08-26 Thread Navkirat Singh
Hi Guys, Not sure if this is the place to ask, but I am trying find out a way to handle application level errors from a global config. Any help would be really appreciated. Regards, Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: bash command, get stdErr

2011-08-26 Thread Tracubik
Il Fri, 26 Aug 2011 01:20:02 -0700, Chris Rebert ha scritto: > On Fri, Aug 26, 2011 at 12:56 AM, Tracubik wrote: >> Il Thu, 25 Aug 2011 01:52:25 -0700, Chris Rebert ha scritto: >>> On Thu, Aug 25, 2011 at 1:25 AM, Tracubik wrote: Hi all! >> >> cut >> >>> Untested: >>> >>> from subprocess im

Re: PUT with proxy-support

2011-08-26 Thread Laszlo Nagy
Running pycurl-7.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-2ZCa8v/pycurl-7.19.0/egg-dist-tmp-DyHFls Using curl-config (libcurl 7.12.1) src/pycurl.c:42:20: Python.h: No such file or directory src/pycurl.c:43:22: pythread.h: No such file or directory src/pycurl.c:58:4: #error "Need Py

Re: is there any principle when writing python function

2011-08-26 Thread Roy Smith
In article , t...@thsu.org wrote: > On Aug 23, 7:59 am, smith jack wrote: > > i have heard that function invocation in python is expensive, but make > > lots of functions are a good design habit in many other languages, so > > is there any principle when writing python function? > > for example

Mastering Python... Best Resources?

2011-08-26 Thread Travis Parks
I know the Python syntax pretty well. I know a lot of the libraries and tools. When I see professional Python programmer's code, I am often blown away with the code. I realized that even though I know the language, I know nothing about using it effectively. I would like to start using Python more

Re: Mastering Python... Best Resources?

2011-08-26 Thread Chris Angelico
On Fri, Aug 26, 2011 at 10:33 PM, Travis Parks wrote: > I know the Python syntax pretty well. I know a lot of the libraries > and tools. When I see professional Python programmer's code, I am > often blown away with the code. I realized that even though I know the > language, I know nothing about

Re: PUT with proxy-support

2011-08-26 Thread Shashwat Anand
On Fri, Aug 26, 2011 at 3:15 PM, Laszlo Nagy wrote: > Running pycurl-7.19.0/setup.py -q bdist_egg --dist-dir > /tmp/easy_install-2ZCa8v/**pycurl-7.19.0/egg-dist-tmp-**DyHFls > >> Using curl-config (libcurl 7.12.1) >> src/pycurl.c:42:20: Python.h: No such file or directory >> src/pycurl.c:43:22: p

Re: Learning python reading software source code

2011-08-26 Thread Chetan Harjani
Thanks Michael :) . I will keep your suggestions in mind. On Fri, Aug 26, 2011 at 9:01 AM, Chetan Harjani wrote: > Hello friends, > > I have learned the basic syntax of python through the book HOW TO THINK > LIKE A COMPUTER SCIENTIST n by reading first 10-11 chapters of > Apress-BEGINNING PROGRAM

Re: Mastering Python... Best Resources?

2011-08-26 Thread Mel
Chris Angelico wrote: [ ... ] > You can get books on algorithms from all sorts of places, and with a > very few exceptions, everything you learn with apply to Python and > also to every other language you use. I liked _Programming Pearls_ by Jon Bentley. No reference to Python -- that would be t

Re: Mastering Python... Best Resources?

2011-08-26 Thread Travis Parks
On Aug 26, 8:44 am, Chris Angelico wrote: > On Fri, Aug 26, 2011 at 10:33 PM, Travis Parks wrote: > > I know the Python syntax pretty well. I know a lot of the libraries > > and tools. When I see professional Python programmer's code, I am > > often blown away with the code. I realized that even

Re: Mastering Python... Best Resources?

2011-08-26 Thread Chris Angelico
On Fri, Aug 26, 2011 at 10:58 PM, Travis Parks wrote: > I haven't gotten to the point where I can truly use the language > features to my full advantage. I haven't seen enough "tricks" to be > effective. I feel like there is so much of the language I am not > utilizing because I'm still thinking i

Re: Mastering Python... Best Resources?

2011-08-26 Thread Kayode Odeyemi
On Fri, Aug 26, 2011 at 2:28 PM, Chris Angelico wrote: > On Fri, Aug 26, 2011 at 10:58 PM, Travis Parks > wrote: > > I haven't gotten to the point where I can truly use the language > > features to my full advantage. I haven't seen enough "tricks" to be > > effective. I feel like there is so muc

Re: Mastering Python... Best Resources?

2011-08-26 Thread Travis Parks
On Aug 26, 9:28 am, Chris Angelico wrote: > On Fri, Aug 26, 2011 at 10:58 PM, Travis Parks wrote: > > I haven't gotten to the point where I can truly use the language > > features to my full advantage. I haven't seen enough "tricks" to be > > effective. I feel like there is so much of the languag

Python IDE/Eclipse

2011-08-26 Thread Dave Boland
I'm looking for a good IDE -- easy to setup, easy to use -- for Python. Any suggestions? I use Eclipse for other projects and have no problem with using it for Python, except that I can't get PyDev to install. It takes forever, then produces an error that makes no sense. An error occurred

dpkg

2011-08-26 Thread Verde Denim
I downloaded cx_oracle for installation to Ubuntu 11.04 64bit this morning, and the alien and dpkg operations worked fine, but on testing the import, the error msg shows that the oracle client lib is missing. I found a thread that mentioned installing the oracle instant client on 11.04 to resolve t

Re: Mastering Python... Best Resources?

2011-08-26 Thread Roy Smith
In article <2309ec4b-e9a3-4330-9983-1c621ac16...@ea4g2000vbb.googlegroups.com>, Travis Parks wrote: > I know the Python syntax pretty well. I know a lot of the libraries > and tools. When I see professional Python programmer's code, I am > often blown away with the code. I realized that even th

Re: dpkg

2011-08-26 Thread Ken Watford
On Fri, Aug 26, 2011 at 10:43 AM, Verde Denim wrote: > Looking for this with find / -name libclntsh.so.11.1 -print produces > /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 > > I'm confused as to why Python doesn't see it... Try running "sudo ldconfig". -- http://mail.python.org/mailman/lis

Re: Python IDE/Eclipse

2011-08-26 Thread Zach Dziura
I've honestly always used either PyDev or IDLE. However, Python is pretty easy to usd without a big IDE slowing you down, so you could also use a developer's text editor like Notepad++ or gedit and still be good. -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any principle when writing python function

2011-08-26 Thread rantingrick
On Aug 26, 6:15 am, Roy Smith wrote: > Maybe.  In general, it's certainly true that a bunch of smallish > functions, each of which performs exactly one job, is easier to work > with than a huge ball of spaghetti code.   Obviously you need to google the definition of "spaghetti code". When you mo

Re: dpkg

2011-08-26 Thread Verde Denim
On Fri, Aug 26, 2011 at 11:17 AM, Ken Watford wrote: > On Fri, Aug 26, 2011 at 10:43 AM, Verde Denim wrote: > > Looking for this with find / -name libclntsh.so.11.1 -print produces > > /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 > > > > I'm confused as to why Python doesn't see it... > >

Re: Python IDE/Eclipse

2011-08-26 Thread Moises Alberto Lindo Gutarra
I like Aptana Studio http://www.aptana.com/products/studio3 2011/8/26 Dave Boland : > I'm looking for a good IDE -- easy to setup, easy to use -- for Python.  Any > suggestions? > > I use Eclipse for other projects and have no problem with using it for > Python, except that I can't get PyDev to in

Unit test failing please help

2011-08-26 Thread lblake
Hi I am new to python I am at bit lost as to why my unit test is failing below is the code and the unit test: class Centipede(object): legs, stomach def __init__(self): def __str__(self): return ','.join(self.stomach) def __call__(self,*args): [self.stomach.appe

Re: Mastering Python... Best Resources?

2011-08-26 Thread Travis Parks
On Aug 26, 11:12 am, Roy Smith wrote: > In article > <2309ec4b-e9a3-4330-9983-1c621ac16...@ea4g2000vbb.googlegroups.com>, >  Travis Parks wrote: > > > I know the Python syntax pretty well. I know a lot of the libraries > > and tools. When I see professional Python programmer's code, I am > > ofte

Re: is there any principle when writing python function

2011-08-26 Thread John Gordon
In <7b47ca17-d3f1-4d91-91d1-98421e870...@ea4g2000vbb.googlegroups.com> rantingrick writes: > Furthermore: If you are moving code out of one function to ONLY be > called by that ONE function then you are a bad programmer and should > have your editor taken away for six months. You should ONLY cre

Re: Python IDE/Eclipse

2011-08-26 Thread Benjamin Kaplan
On Aug 26, 2011 11:39 AM, "Moises Alberto Lindo Gutarra" wrote: > > I like Aptana Studio > http://www.aptana.com/products/studio3 > FYI, Aptana is just a set of extensions for Eclipse. Aptana Studio is just Eclipse with all of the Aptana extensions (including PyDev) preinstalled. > 2011/8/26 Dav

Re: is there any principle when writing python function

2011-08-26 Thread Tobiah
Furthermore: If you are moving code out of one function to ONLY be called by that ONE function then you are a bad programmer and should have your editor taken away for six months. You should ONLY create more func/methods if those func/methods will be called from two or more places in the code. T

Hot Bollwood Actresses and Hot Football Players of Spain Soccer Team

2011-08-26 Thread Ashraf Ali
Hot Bollywood Actresses and Hot Football Players of Spain Nation Soccer Team. http://bollywoodactresseshotdresses.blogspot.com/ http://spainnationalfootballteamwallpapers.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Unit test failing please help

2011-08-26 Thread John Gordon
In lblake writes: > Hi I am new to python I am at bit lost as to why my unit test is > failing below is the code and the unit test: > class Centipede(object): > legs, stomach You aren't assigning any values to "legs" or "stomach" here. From your later code, it seems like you intend these

Re: Design principles: no bool arguments

2011-08-26 Thread Thomas 'PointedEars' Lahn
Ian Kelly wrote: > Thomas 'PointedEars' Lahn wrote: >> Both variants work (even in Py3) if you only define [a named argument]. >> You have to define [a keyword argument, e.g. `kwargs']. >> >> so that >> >> data1.merge_with(data2, True); >> >> is a syntax error ("TypeError: merge_with() takes exact

Why PyImport_ExecCodeModule takes char*?

2011-08-26 Thread Mateusz Loskot
Hi, I'm wondering, why PyImport_ExecCodeModule function takes char* instead of const char*? Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org Member of ACCU, http://accu.org -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any principle when writing python function

2011-08-26 Thread Chris Angelico
On Sat, Aug 27, 2011 at 1:48 AM, Tobiah wrote: > While I understand and agree with that basic tenet, I think > that the capitalized 'ONLY' is too strong.  I do split out > code into function for readability, even when the function > will only be called from the place from which I split it out. >

Re: Python IDE/Eclipse

2011-08-26 Thread smackay
You can get a lot done, if not everything, with a simple editor however for me an IDE is awesome for digging around in the django internals to see how it all works. I used PyDev initially then onto emacs but finally I settled on PyCharm - it's just like PyDev except that everything works.

Re: Unit test failing please help

2011-08-26 Thread Tim Wintle
On Fri, 2011-08-26 at 08:35 -0700, lblake wrote: > Hi I am new to python I am at bit lost as to why my unit test is > failing below is the code and the unit test: > > class Centipede(object): > legs, stomach This doesn't do what you think it does. "legs, stomach" is a statement and is not de

Re: Python IDE/Eclipse

2011-08-26 Thread Thomas 'PointedEars' Lahn
Dave Boland wrote: > I'm looking for a good IDE -- easy to setup, easy to use -- for Python. > Any suggestions? PyDev (currently 2.2.1.2011073123, from the Aptana Studio 3.0.4 Plugin; but I can see that 2.2.2 has been released). > I use Eclipse for other projects and have no problem with usin

Re: is there any principle when writing python function

2011-08-26 Thread Steven D'Aprano
Tobiah wrote: > >> Furthermore: If you are moving code out of one function to ONLY be >> called by that ONE function then you are a bad programmer and should >> have your editor taken away for six months. You should ONLY create >> more func/methods if those func/methods will be called from two or

Record seperator

2011-08-26 Thread greymaus
Is there an equivelent for the AWK RS in Python? as in RS='\n\n' will seperate a file at two blank line intervals -- maus . . ... NO CARRIER -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any principle when writing python function

2011-08-26 Thread rantingrick
On Aug 26, 10:40 am, John Gordon wrote: > In <7b47ca17-d3f1-4d91-91d1-98421e870...@ea4g2000vbb.googlegroups.com> > rantingrick writes: > > > Furthermore: If you are moving code out of one function to ONLY be > > called by that ONE function then you are a bad programmer and should > > have your e

Re: Record seperator

2011-08-26 Thread D'Arcy J.M. Cain
On 26 Aug 2011 18:39:07 GMT greymaus wrote: > > Is there an equivelent for the AWK RS in Python? > > > as in RS='\n\n' > will seperate a file at two blank line intervals open("file.txt").read().split("\n\n") -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy

Catch and name an exception in Python 2.5 +

2011-08-26 Thread Steven D'Aprano
In Python 3, you can catch an exception and bind it to a name with: try: ... except ValueError, KeyError as error: pass In Python 2.5, that is written: try: ... except (ValueError, KeyError), error: pass and the "as error" form gives a SyntaxError. Python 2.6 and 2.7 accept eit

Re: Catch and name an exception in Python 2.5 +

2011-08-26 Thread Thomas Jollans
On 26/08/11 21:56, Steven D'Aprano wrote: > In Python 3, you can catch an exception and bind it to a name with: > > try: > ... > except ValueError, KeyError as error: > pass > > In Python 2.5, that is written: > > try: > ... > except (ValueError, KeyError), error: > pass > > and

Re: is there any principle when writing python function

2011-08-26 Thread Chris Angelico
On Sat, Aug 27, 2011 at 4:05 AM, rantingrick wrote: > Now take a look at MY simple ONE module solution. It has JUST enough > methods and NOT a single more! I disagree - create_widgets() is completely unnecessary in the presence of show(), unless it's possible to show the dialog, hide it, and then

The RAISE_VARARGS opcode in Python 3

2011-08-26 Thread Arnaud Delobelle
Hi all, Here is an extract from the dis module doc [1] """ RAISE_VARARGS(argc) Raises an exception. argc indicates the number of parameters to the raise statement, ranging from 0 to 3. The handler will find the traceback as TOS2, the parameter as TOS1, and the exception as TOS. """ OTOH, looking

Re: is there any principle when writing python function

2011-08-26 Thread rantingrick
On Aug 26, 4:45 pm, Chris Angelico wrote: > On Sat, Aug 27, 2011 at 4:05 AM, rantingrick wrote: > > Now take a look at MY simple ONE module solution. It has JUST enough > > methods and NOT a single more! > > I disagree - create_widgets() is completely unnecessary in the > presence of show(), Wel

Re: is there any principle when writing python function

2011-08-26 Thread rantingrick
On Aug 26, 1:16 pm, Steven D'Aprano wrote: > (3) Fault isolation. If you have a 100 line function that fails on line 73, > that failure may have been introduced way back in line 16. By splitting the > function up into smaller functions, you can more easily isolate where the > failure comes from,

Re: is there any principle when writing python function

2011-08-26 Thread Steven D'Aprano
Chris Angelico wrote: > On Sat, Aug 27, 2011 at 4:16 AM, Steven D'Aprano > wrote: >> I can think of at least five reasons apart from re-use why it might be >> appropriate to pull out code into its own function or method even if it >> is used in one place only: > > I'm glad you say "might be", be

Re: is there any principle when writing python function

2011-08-26 Thread Chris Angelico
On Sat, Aug 27, 2011 at 11:26 AM, Steven D'Aprano wrote: > I say "might be" because I mean it: these arguments have to be weighed up > against the argument against breaking code out of functions. It's easy to > imagine an extreme case where there are a billion *tiny* functions, each of > which doe

Re: Catch and name an exception in Python 2.5 +

2011-08-26 Thread Steven D'Aprano
Thomas Jollans wrote: > On 26/08/11 21:56, Steven D'Aprano wrote: >> Is there any way to catch an exception and bind it to a name which will >> work across all Python versions from 2.5 onwards? >> >> I'm pretty sure there isn't, but I thought I'd ask just in case. > > It's not elegant, and I ha

Re: The RAISE_VARARGS opcode in Python 3

2011-08-26 Thread Peter Otten
Arnaud Delobelle wrote: > Here is an extract from the dis module doc [1] > > """ > RAISE_VARARGS(argc) > Raises an exception. argc indicates the number of parameters to the > raise statement, ranging from 0 to 3. The handler will find the > traceback as TOS2, the parameter as TOS1, and the except