How to add mysql-python image path to crontab

Crontab always try to load mysql-python image from my home directory, while the library image is actually in /Library/Python/2.7/site-packages/MySQL_python... How can I point crontab to the right place? Without reinstall mysql-python as a static library?

I work on MAC OS 10.7. Thanks.

-------------Problems Reply------------

Run env at your command-line and copy its output. Add that to the top of your crontab, as that will set the environment for the cron to run - this should do the trick. You can then remove unwanted environment variables at your own leisure.

Reference for Mac OS X:

crontab file

When you add cron jobs (using conrtab -e), they are neither run under your Mac OS X login nor under a tcsh shell, so you can also set envrionment variables in your crontab which will get used when executing cron actions.

PERL5LIB=/Library/Perl:/Users/yourusername/perl
LC_ALL=C

12 1 * * * perl dosomething.pl

Source: Peter's Mac OS X Notes.

Notice that the environment setting on cron does NOT require you to add the export commands. Drop them at the top of the cron file and that will do it.

Category:python Views:0 Time:2011-12-22

Related post

  • How do i add a python package path during runtime 2011-04-19

    Here is a scenario, i hope you can help me with. I have python unit tests in /home/k/PR-TEST/Pr/test [email protected]:~/PR-TEST/Pr-test$ ls _apache.py archive clienttest decorators.py fakeTecoreClient.py fixtures.pyc psqlharness.py servertest testhelp.

  • How to add a Python import path using a .pth file 2009-03-31

    If I put a *.pth file in site-packages it's giving an ImportError. I'm not getting how to import by creating a *.pth file. (Refers to importing in python) --------------Solutions------------- If you put a .pth file in the site-packages directory cont

  • Add a directory to Python sys.path so that it's included each time I use Python 2011-09-19

    Currently, when trying to reference some library code, I'm doing this at the top of my python file: import sys sys.path.append('''C:\code\my-library''') from my-library import my-library Then, my-library will be part of sys.path for as long as the se

  • Looking to get started with Apache, PHP, MySQL, Python, Django on a fresh Mac 2009-03-10

    I've looked for other questions, but could not find any... I have freshly installed my Mac with OSX 10.5. I need to learn Python/Django for a new job, so want to set it all up correctly, ready to develop and run from my browser using http://localhost

  • mysql-python: building a completely standalone _mysql.so on Mac OS X? 2009-12-27

    I'm running a database server in a Linux VM (Ubuntu 9.10) under VMware Fusion, but coding Django on the Mac side. Installing mysql-python requires that MySQL is installed on the Mac for compiling _mysql.so into site-packages. However, after this is d

  • mysql-python install problem using virtualenv, windows, pip 2009-12-29

    I'm trying to install mysql-python in a virtualenv using pip on windows. At first, I was getting the same error reported here, but the answer there worked for me too. Now I'm getting this following error: _mysql.c(34) : Fatal error C1083: Cannot open

  • Modifying DYLD_LIBRARY_PATH for mysql, python, and django 2011-02-22

    I've seen two dozen posts concerning this issue, but I'm so NOOB I'm not sure how to modify everything correctly. I'm attempting to finish the installation, but when I go to Python and "import MySQLdb" I end up getting: ImportError: dlopen(/Users/pcc

  • pip install mysql-python fails with EnvironmentError: mysql_config not found 2011-03-03

    This is the error I get (mysite)[email protected]:~/zjm_test/mysite$ pip install mysql-python Downloading/unpacking mysql-python Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded Running setup.py egg_info for package mysql-python s

  • mysql-python installation problems (on mac os x lion) 2011-09-07

    I installed everything successfully, or so I thought: MySQL 5.5 for x86_64. Python 2.7, x86_64. mysql-python 1.2.3, x86_64. But when I try: import MySQLdb I get: ImportError: dlopen(/Users/aj/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-ix86_64.

  • Installing MySQL-python 2011-09-18

    I got the below failure while trying to get MySQL-python installed on my Ubuntu/Linux Box.From the below it seem like the issue is sh: mysql_config: not found Could someone advice me on what to do? [email protected]:~$ pip install MySQL-python Downloadin

  • Mac OS X 10.6, Mysql, Mysql-Python, Django 2012-01-01

    UPDATE: I came across this post: Python mysqldb on Mac OSX 10.6 not working saw two options: Add MySQL client libraries to the LD_LIBRARY_PATH mysql_config --libs -L/usr/local/mysql/lib -lmysqlclient -lpthread So I don't need to do anything here. jus

  • virtualenv, mysql-python, pip: anyone know how? 2009-10-02

    This question already has an answer here: pip install mysql-python fails with EnvironmentError: mysql_config not found 20 answers I'm trying to install the mysql bindings in a virtualenv. I'd prefer to use pip or easy_install. pip gives me the follow

  • MySQL-python 1.2.3 and OS X 10.5: 64- or 32-bit? 2009-12-28

    I've been happily using Django and MySQL in development on an existing machine running OS X 10.4 Tiger, and have set up a similar environment in 10.5 Leopard on a new 64-bit MacBook, with a working MySQL and Python 2.6.4. However, now I want them to

  • How to add MySQL connector/C++ 1.1 to Visual Studio 2010 project? 2011-02-24

    I'm trying to add MySQL Connector/C++ to my visual Studio 2010 project. I followed the steps (here, mysql docs) to add it to Visual Studio (I also added Boost in the "Additional include Directories"). It asked for a "sqlstring.h" file ( How a release

  • Registry error when installing MySQL-python into virtualenv using pip and easy_install 2011-04-13

    The pip and easy install commands (install MySQL-python) provide the massive error listed below. I've been looking around for an answer a while now on this site and through google. The recurring answer is to install python dev (pip install python-dev

  • Cannot install MySQL-Python 2011-06-02

    for some reason I'm unable to install the MySQL-Python package in neither my virtualenv nor in my main Python install on OS X. I'm getting the following output: Downloading/unpacking MySQL-Python Running setup.py egg_info for package MySQL-Python war

  • Cannot import mysql-python in crontab Mac OS 2011-12-01

    I wrote a script which runs ok, but when I run it from crontab I get an import error. Traceback (most recent call last): File "/Users/.../Desktop/test.py", line 3, in <module> import MySQLdb as mysql File "build/bdist.macosx-10.7-intel/egg/MySQ

  • MySQL-Python with PyPy 2011-12-28

    MySQL-Python (MySQLdb) is known to work with PyPy. How do you make it work? I tried downloading it and installing: C:\dev\Installs\MySQL-python\MySQL-python-1.2.3>pypy setup.py install Traceback (most recent call last): File "app_main.py", line 51

  • mysql-python collation issue: how to force unicode datatype? 2012-03-01

    For certain purposes I had to change field collations from utf8_unicode_ci to utf8_bin in a database. It turned out that the change lead to changes in datatypes that come to python. The question is how to force mysql-python to return unicode objects

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.118 (s). 11 q(s)