Re: How to parse the os.system() output in python

2007-03-17 Thread Dave Reed

On Mar 17, 2007, at 8:28 PM, [EMAIL PROTECTED] wrote:

 Hi,

 I use os.system() to execute a system command in python.
 Can you please tell me how can I parse (in python) the output of the
 os.system()  ?

 Thank you.


Sounds like you want os.popen, not os.system.

http://docs.python.org/lib/module-popen2.html

Dave

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


Re: mxDateTime on Mac: Fatal Python Error

2005-03-07 Thread Dave Reed

On Monday 07 March 2005 17:51, M.-A. Lemburg wrote:
 [EMAIL PROTECTED] wrote:
  I'm trying to get mxDateTime working on a Mac so that I can use 
pyscopg
  and cx_Oracle. The Egenix base package builds and installs quite
  happily, but then when I try to import it I get
  
  
 import mx.DateTime
  
  Fatal Python error: Interpreter not initialized (version mismatch?)
  Abort
  
  ... any ideas?
 
 Messages like these are usually the result of a version mismatch
 between the Python interpreter and the .so file of the extensions.
 
 Make sure you build the package using the same Python interpreter
 you will later use it with.
 
  Environment:
  
  OS X 10.3.8
  sys.version: '2.3 (#1, Sep 13 2003, 00:49:11) \n[GCC 3.3 20030304
  (Apple Computer, Inc. build 1495)]'
  egenix-mx-base-2.0.6
 
 Hmm, this might also be some weird Mac OS issue. While we currently
 don't support Macs directly, we do welcome suggestions to make them
 work on your favorite platform.
 
 Thanks,
 -- 
 Marc-Andre Lemburg
 eGenix.com



Works fine for me on a 2004 PowerBook with 10.3.8.

I'm using Python from DarwinPorts for pygtk and am using mx.DateTime 
with it. I don't remember if DarwinPorts had mx.DateTime or if I 
downloaded the source and installed it myself. I suspect it's the 
version mismatch problem mentioned above.

502 mac:~ $ /opt/local/bin/python
Python 2.3.4 (#1, Nov  9 2004, 21:05:33) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type help, copyright, credits or license for more information.
 import mx.DateTime
 


Dave

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


Re: Appeal for python developers (THIS IS A TROLL)

2005-03-05 Thread Dave Reed
On Saturday 05 March 2005 09:34, Thomas Rösner aka TRauMa wrote:
 BOOGIEMAN wrote:
  Please include goto command in future python realeses
  I know that proffesional programers doesn't like to use it, 
  but for me as newbie it's too hard to get used replacing it 
  with while, def or other commands
 
 Technically, as a newbie you shouldn't know about GOTO at all. So 
you're 
 more a Tainted by previous spaghetti code practices-guy than newbie.


Or more likely a troll. Google for:

 Boogieman yahoo troll

and you'll see this isn't the only place he/she does this sort of thing.

Please don't feed the trolls.

Dave

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


Re: what would you like to see in a 2nd edition Nutshell?

2004-12-30 Thread Dave Reed
On Wednesday 29 December 2004 18:01, Alex Martelli wrote:
snip

 So -- ctypes is definitely getting a _mention_, at least... the issue
 remains of whether we're talking one paragraph, like for all other
 extending-tools that were already thus mentioned in the 1st edition, 
or
 a couple of pages (I can't possibly spend 2-3 pages on each of a dozen
 extending tools, much as I'd love to!).
 
 
  Perhaps a more resonable sugestion would be a short section on 
integration
  with native systems, e.g. an intro/overview to (non exhaustive 
list):
  
  psyco
  scipy.blitz/weave
  ctypes
  pyrex

snip

  they all represent intreresting areas.  Perhaps the section could 
end with
  some words on PyPy.
 
 Speaking as somebody who's participated in more than half of the pypy
 sprints and hopes for more, I think pypy needs to be mentioned much
 earlier, together with other alternate implementations of Python.
 
 I do agree that vast coverage is outside the scope that the Nutshell's
 size lets me aim for.  However, mere mention appears to lead to a
 serious risk of the pointer being entirely missed -- e.g. despite 
being
 interested in these issues you appear to be unaware of p. 545 (1st 
ed).
 Hmmm -- maybe I need to strike some kind of balance here (so what else
 is new...;-).

snip

This discussion is making me think what would be really nice is an 
advanced Python book that discusses many of the topics mentioned in 
this message and earlier messages in the thread. I'd rather see an 
in-depth advanced book than light coverage of the topics added to a 
Nutshell book.  I own at least 8 or 9  Python books now and the 3 that 
I keep within arms reach of the computer are Nutshell, Cookbook, and 
Python Essential Reference. 

Dave

Dave

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


Re: Redirecting ./configure --prefix

2004-12-13 Thread Dave Reed
On Monday 13 December 2004 21:15, Dan wrote:
 I suspect this isn't specifically a Python question, but I
 encountered it with Python so I thought I'd ask here.
 
 I'm running Linux (Fedora 2), and just downloaded the Python 2.4
 kit.  I did the following from my user account:
  ./configure --prefix=/some/private/dir --enable-shared
  make
  make test # all was okay
  make install
 
 Now, when I try to run this I get the following error:
  python: error while loading shared libraries:
  libpython2.4.so.1.0: cannot open shared object file: No such
  file or directory
 
 This library is in /some/private/dir/lib, but that directory is
 not being searched.
 
 So, I have these questions:
  - Can I get Python to search /some/private/dir/lib for
library files?
  - Will sys.path be okay?  How can I make it okay?
  - Is there anything else I need to worry about?

I think you just need to this if your shell is bash (default shell in 
FC2 I think)
LD_LIBRARY_PATH=/some/private/dir/lib; export LD_LIBRARY_PATH
or if you're using csh or tcsh
setenv LD_LIBRARY_PATH /some/private/dir/lib

If that works, you can put this in the appropriate dot file so you don't 
have to retype them each time you login/create a new shell.

For bash I think it's ~/.bashrc or ~/.profile
and for csh it's ~/.cshrc and ~/.tcshrc for tcsh.

HTH,
Dave


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