2

I can't see anything anywhere showing examples of how to use virtual environments with incron http://inotify.aiken.cz/

Does anyone know if this is even possible?

Update: I run incrontab -e I then add this line:

/home/vmail/jobstat.us/submit/new/ IN_CREATE /home/vmail/jobstatuspy3/bin/python3 /home/vmail/mailtounicodetoarchive.py --context=prd

However when I try to run the same from the command line i.e.

/home/vmail/jobstatuspy3/bin/python3 /home/vmail/mailtounicodetoarchive.py --context=prd

It says

vmail@mail:~$ /home/vmail/jobstatuspy3/bin/python3 /home/vmail/mailtounicodetoarchive.py --context=prd
Traceback (most recent call last):
  File "/home/vmail/mailtounicodetoarchive.py", line 14, in <module>
    me = singleton.SingleInstance()
NameError: name 'singleton' is not defined

Obviously the above error is because it's not actually executing the command in a venv and so the tendo module which I installed in the venv does not work.

Any thoughts on how to get venvs to work with incron?

4

3 に答える 3

1

activate通常はシェルに入力するものを直接 Python コードに入れることができます。プロジェクトに名前を付ける場合は、A次のようになります。

activate_this = 'A/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
于 2013-05-20T12:15:26.627 に答える
1

仮想環境をアクティブにしてプログラムを実行するために通常使用するすべてのコマンドを含むシェル スクリプトを記述します。

次に、incron をセットアップしてシェル スクリプトを実行します。

于 2013-05-20T12:12:34.177 に答える