Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running entry point via cron fails #613

Closed
sheeley opened this issue May 21, 2014 · 1 comment
Closed

Running entry point via cron fails #613

sheeley opened this issue May 21, 2014 · 1 comment

Comments

@sheeley
Copy link

sheeley commented May 21, 2014

I'm running into a similar (but different?) issue to #124 when running an entry point via cron.

When I run normally (within or outside a virtualenv) like so:

nohup ~/.virtualenvs/testenv/bin/ensure_server_running ~/path/ > /tmp/cron.log 2>&1

Here's what I get:

~/.virtualenvs/testenv/bin/ensure_server_running
~/.virtualenvs/testenv/bin/ensure_server_running:5: UserWarning: Module _markerlib was already imported from /usr/local/lib/python2.7/site-packages/setuptools-3.4.1-py2.7.egg/_markerlib/__init__.pyc, but ~/.venvburrito/lib/python/distribute-0.6.46-py2.7.egg is being added to sys.path
  from pkg_resources import load_entry_point

INFO     config.py 92  loading config
...

Other than the venvburrito warning (which never seems to affect things), it runs fine.

However, when the same command:

* * * * * nohup ~/.virtualenvs/testenv/bin/ensure_server_running ~/path/ > /tmp/cron.log 2>&1

Is run via cron, this is the output:

Traceback (most recent call last):
  File "~/.virtualenvs/testenv/bin/ensure_server_running", line 5, in <module>
    from pkg_resources import load_entry_point
  File "~/.virtualenvs/testenv/lib/python2.7/site-packages/pkg_resources.py", line 2829, in <module>
    working_set = WorkingSet._build_master()
  File "~/.virtualenvs/testenv/lib/python2.7/site-packages/pkg_resources.py", line 449, in _build_master
    ws.require(__requires__)
  File "~/.virtualenvs/testenv/lib/python2.7/site-packages/pkg_resources.py", line 742, in require
    needed = self.resolve(parse_requirements(requirements))
  File "~/.virtualenvs/testenv/lib/python2.7/site-packages/pkg_resources.py", line 639, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: ipython>=0.10

Any ideas?

@sheeley
Copy link
Author

sheeley commented May 21, 2014

I just had to prefix it like so:

env -i PYTHONPATH=$PYTHONPATH nohup ~/.virtualenvs/testenv/bin/ensure_server_running ~/path/ > /tmp/cron.log 2>&1

@sheeley sheeley closed this as completed May 21, 2014
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant