473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

problem with crontab on copmuter with two python version

9
Hi,
I'm using a computer with a Linux CentOS Operating system, which uses python 2.3 and known to break if python is upgraded to 2.5. Since i need to run 2.5 scripts on that machine, some people in a linux forum recommended to compile 2.5 on that machine and have two python interpreters installed. so now, when i type "python" i still get the 2.3 version, and when i type "python2" i get the new version. to make sure it works i created a simple script called CheckVersion.py:
Expand|Select|Wrap|Line Numbers
  1. import sys
  2. print sys.version
  3.  
when run with python2 it outputs that the version is 2.5 and when run using "python" it outpus 2.3. so far so good. but, when i set up a crontab job:
* * * * * python2 CheckVersion.py > /usr/local/testLog
suddenly i see that somehow the output is that of the 2.3 version...
why is that? the only thing i can think of is that somehow because crontab has different PATH vars the python2.5 interpreter imports the 2.3 sys module... but that sounds rather odd. any ideas?
Oct 7 '07 #1
3 1552
bartonc
6,596 Expert 4TB
On Windows there's an environment variable called PYTHONPATH.
Directories named in that variable are appended to sys.path.
Check that by:
Expand|Select|Wrap|Line Numbers
  1. import sys
  2. print sys.path
Oct 7 '07 #2
noama
9
But how does that make python2.5 use imports of python2.3?
Oct 7 '07 #3
bartonc
6,596 Expert 4TB
But how does that make python2.5 use imports of python2.3?
There is only one environment variable called PYTHONPATH in a (Windows, anyway) system.
Both versions would use that to extend their search depth. The way to resolve this is to make sure that the module is question is in the is in the respective site-packages directory and ensure that site-packages is NOT in the environment variable.
Oct 7 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Arkascha | last post by:
Maybe someone can give me a short help with this... I got a server application in a LAMP environment doing batch tasks. A cronjob serves as a regular trigger, a metronom. The trigged...
4
by: David Bruno | last post by:
I set up a crontab using cpanel8 for the first time. It's just to run a very simple php script that sends an email and has one include() function. The first try at the crontab produced a...
3
by: Frank R. Suchy | last post by:
Hi, I want a php-script to maintain (some of) "my" cron jobs. Therefore it has to modify some crontab.txt (no problem) and has to execute crontab. But since php runs as the apache-user it...
3
by: rbt | last post by:
How can I safely append a crontab entry to a crontab file progammatically with Python? I need to handle crontabs that currently have entries and crontabs that are empty. Also, I'd like this to...
2
by: David Garamond | last post by:
I was thinking on how one would design an optimal (performance-wise) database of large number of schedules with crontab-like semantic. There will potentially be hundreds of thousands or even...
0
by: zapatax | last post by:
Hi, I wish to know from within a python script whether I'm being executed interactively or by a crontab, so I won't ask for confirmation in the latter case. Is this possible? and in Jython? Thanks in...
2
by: martijn | last post by:
H! I have made a program that is checking if a program is running or not. If the program is not running then it must start the program again. in the /etc/crontab: * * * * ...
0
by: Martin Marcher | last post by:
Hello, is anyone aware of a crontab library. Possibly even more complete, something that will let me create/manipulate/delete crontab entries in a nice way and install the new crontab...
3
by: VictorMiller | last post by:
I've written a python script which, using urllib, and urllib2 will fetch a number of files that that I'm interested in from various websites (they're updated everyday). When I run the script from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.