简体   繁体   中英

pm2 for running python script with arguments

I am trying to run python script with arguments (I have to pass a path to the config for the script to run well).

I am doing it way:

pm2 start script.py --name appname --interpreter python3 -- config/xyz.yml

I have been using pm2 for quite some time and I know that custom parameters are after --

But with running python scripts it obviously doesn't work this way.

I launch my scripts in the same manner without any problems. The only difference is that I pass the whole path to python interpreter ( /usr/bin/python3 ) instead of just python3 . Have you tried with the absolute path for config/xyz.yml ? Relative path should also work though

pm2 start script.py --name appname --interpreter python3 -- config/xyz.yml

This is the right way to call the argument. It was my fault, I have made mistake in reading those argument. So it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM