Reputation: 361
I try to run a python3 script notifying be about twitter posts on my Ubuntu server. Doing this in command line works fine, but when I use pm2 to keep the script online after closing the console, I get this error:
Traceback (most recent call last):
File "/root/projects/Twitterbot/main.py", line 1, in <module>
from tweepy.streaming import StreamListener
ImportError: No module named tweepy.streaming
When I switch the interpreter from python
to python3
nothing at all happens, it doesn't crash. It takes some RAM, but it doesn't seem to do anything.
Does someone know what might be the issue? An other Python script (which imports a lot of things) is running fine without any issues.
I already reinstalled tweepy using pip but no change
Upvotes: 4
Views: 2385
Reputation: 2387
but it doesn't seem to do anything
I had a similar problem, it turns out python3
buffers all output by default with pm2
or nohup
. So the logs won't show anything and pm2 monit
won't show anything.
Run python3
with -u
flag to flush everything ASAP.
pm2 start myscript.py --interpreter python3 --interpreter-args -u
Upvotes: 6