[SOLVED] cron compatible way to launch pyplanet?

Python 3 Server Controller for Trackmania and Shootmania for script-only modes.

Moderators: TheM, toffe, NADEO

Post Reply
TheBigG.
Posts: 404
Joined: 11 Jun 2011, 16:11

[SOLVED] cron compatible way to launch pyplanet?

Post by TheBigG. »

Hi,
is there a way to launch pyplanet via cron? The way i do it for PHP stuff doesn't work with it and google could not bring up a working solution sadly

Code: Select all

su -s /bin/bash -c "python3 /home/tm2/py_6001_pyplanet/manage.py start --detach --pid-file=pyplanet.pid" pyplanet
That produce this error

Code: Select all

Traceback (most recent call last):
  File "/home/tm2/py_6001_pyplanet/manage.py", line 8, in <module>
    from pyplanet.core.management import execute_from_command_line
ImportError: No module named 'pyplanet'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/tm2/py_6001_pyplanet/manage.py", line 14, in <module>
    ) from exc
ImportError: Couldn't import PyPlanet. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
Thanks for help
Client:
OS: Win10/Debian CPU: Intel 9900k GPU: NVIDIA 1080TI Display: 3x Acer Predator XB271HUbmiprz 1440p@165 Hz

Server:
OS: Debian Stable @ Backports Kernel CPU: Intel 6700k RAM: 32 GB Storage: 2x 256 GB NVMe SSD@Raid 1
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: cron compatible way to launch pyplanet?

Post by toffe »

Are you using a virtualenv? You need to activate it in the whole command as well.

For this you can prefix your command with:

Code: Select all

source /path/to/env/bin/activate && start_cmd
Or in case of pyenv

Code: Select all

eval "$(pyenv init -)" && start_cmd
Let me know if this helps for you,
Toffe
TheBigG.
Posts: 404
Joined: 11 Jun 2011, 16:11

Re: cron compatible way to launch pyplanet?

Post by TheBigG. »

I finaly found the problem, if you follow the doku of pyplanet you create a standalone python installation but i started pyplanet always with the system python. starting the manage.py with /home/pyplanet/.pyenv/shims/python3 solved it.
I realy dislike how this python stuff has its own update mechanism and that it does create standalone installations. running pyplanet in a docker container to stop python screwing the complete system up would be nice.
Maybe you could think about a docker image for pyplanet?
Client:
OS: Win10/Debian CPU: Intel 9900k GPU: NVIDIA 1080TI Display: 3x Acer Predator XB271HUbmiprz 1440p@165 Hz

Server:
OS: Debian Stable @ Backports Kernel CPU: Intel 6700k RAM: 32 GB Storage: 2x 256 GB NVMe SSD@Raid 1
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: cron compatible way to launch pyplanet?

Post by toffe »

Indeed. You kinda have to use the virtualenv so you won't screw your OS installation of python, that's unfortunately a downside of the python architecture. I already looked into making a single executable for PyPlanet which has an embedded python version inside, but with the loading of the dynamic apps and templates for manialinks it's kind of hard to get it working perfectly. I should invest more time in finding a working solution for it.

Well in fact, there is already a beginning of an docker image for pyplanet and maniaplanet. I've made the images on the hub page here: https://hub.docker.com/u/pyplanet/

Toffe
Post Reply

Return to “PyPlanet”

Who is online

Users browsing this forum: No registered users and 3 guests