Multiplatform scripts: Can I avoid os.sep?

2006-07-13 Thread gmax2006
Hi,

I am developing scripts that must run on both Linux and windows.

My scripts contain lots of relative paths (such as log\\log.txt or
ctl\\table.ctl) If I use os.sep, it makes the code ugly. Is there any
tips or techniques to have Python automatically converts \\ to / when
the script runs on Linux? What is the best way to deal with this
situation?

Thank you,
Max

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


RedHat: Easiest way to upgrade from Python 2.3 to 2.4

2006-07-13 Thread gmax2006
Hi,

My RedHat Linux installation already has Python 2.3 on it.
What is the easiest way to upgrade it to 2.4?

I use ActiveState python in Windows. Is it the best distribution for
Linux as well?

Thank you,
Max

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


Re: RedHat: Easiest way to upgrade from Python 2.3 to 2.4

2006-07-13 Thread gmax2006

Fredrik Lundh wrote:
> DO NOT do a full install; you'll most likely break RedHat stuff if you
> do that.

I was expecting an rpm to do the update. This is a sensitive production
box. I think I should just continue with Python 2.3.

Regards,

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


Hard time with installing MySQLdb for Python on Linux

2006-07-14 Thread gmax2006
Hi,

I am having hard time with installing MySQLdb on Linux.

My Python version is 2.3. I have downloaded
"MySQL-python-1.2.1_p2.tar.gz" from sourceforge. The README file
asks for MySQL installation. My MySql server is on another box. That is
why I think I should to install just the MySql client (am I right?).

My Linux is "Red Hat Enterprise Linux ES release 4 (Nahant)"

These RPMs are available on the MySql download for "Red Hat
Enterprise Linux 4 RPM (x86) downloads":

Server
Client
Shared libraries
Shared compatibility libraries (3.23, 4.x, 5.x libs in same package)
Headers and libraries
Test suite
Debug information




Which one of above RMPs should I install on my RedHat box to be able to
make "MySQL-python-1.2.1_p2.tar.gz" work?

Any help would be appreciated,
Max

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


Should this be added to MySQLdb FAQ?

2006-07-18 Thread gmax2006
Hi,

I went through couple of wrong paths to install MySQLdb on my RedHat
box. I was trying to download MySQL client from MySQL.com and also
mySQLdb from SourceForge. After some challenges with compile errors and
also searching for pre-required RPMs, I found RedHat distribution
already contains all compiled rpms and all I need are within CDs 3 and
4 of RedHat distribution!

In essence, I found that I should check my Linux distribution first,
then attempt to download stuff from sourceforge!

I also posted the question to this group:
http://groups.google.ca/group/comp.lang.python/browse_thread/thread/41c53c2c932dfa58/f72f09a863bffdb2?hl=en#f72f09a863bffdb2

If this makes sense, should it be added to MySQLdb FAQ?

Regards,
Max

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


ImportError: libclntsh.so.10.1: cannot open shared object file: Permission denied

2006-07-20 Thread gmax2006
Hi,

I am using RedHat Linux 4. and I developed an oracle 10g based
application by using cx_Oracle (cx_Oracle-4.1-10g-py23-1.i386.rpm) and
Python 2.3.4.

When I run the application through direct console connection, It works
perfect.

But, when I schedule a crontab job to run the application, It logs this
error:

Traceback (most recent call last):
  File "/home/nsm1/NSM1/NSM1.py", line 5, in ?
import cx_Oracle
ImportError: libclntsh.so.10.1: cannot open shared object file:
Permission denied


How can I fix the problem?

Any help would be appreciated,
Max

BTW:

I have the following settings in my /etc/profile file:

#---
ORACLE_BASE=/home/oracle/oracle/product
ORACLE_HOME=$ORACLE_BASE/10.2.0/db_1
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$PATH:$ORACLE_HOME/bin
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH
#---

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


Search within running python scripts

2006-07-24 Thread gmax2006
Hi,

Is it possible that a python script finds out whether another instance
of it is currently running or not?

Thank you,
Max

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


Re: Search within running python scripts

2006-07-24 Thread gmax2006

Simon Forman wrote:
> gmax2006 wrote:
> > Hi,
> >
> > Is it possible that a python script finds out whether another instance
> > of it is currently running or not?
> >
> > Thank you,
> > Max
>
> Yes, there are several ways.  What OS are you using?
>
> ~Simon

I have to use an os-independent approach.

At this point I use a file as running-flag. It doesn't work so good.
Because if the python application breaks or get terminated, it won't
run again unless somebody deletes the flag file.

Alan

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


sys.argv[0] doesn't always contain the full path of running script.

2006-08-29 Thread gmax2006
Hi,

I use RedHat linux.

How can I find where exactly the current python script is running?

I use this code:

#test.py
import os,sys
print sys.argv
os.chdir(os.path.dirname(sys.argv[0]))


It doesn't work when I run this command from the directory that
test.py is located:

python test.py

That means sys.argv[0] doesn't always contain the full path of
running script.

Any help would be appreciated,
Max

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