[SOLVED] Error When starting PyPlanet

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

Moderators: TheM, toffe, NADEO

Locked
Pilax
Posts: 17
Joined: 18 Jun 2017, 11:13

[SOLVED] Error When starting PyPlanet

Post by Pilax »

Hi,

After following the installation guide, which is not always very clear, and after several tests, I can not launch PyPlanet.

- I installed Python 3.6.1 for windows
- I created the vitrual environment
- I install Pyplanet into the environment
- I created a directory to initialize the project to save the configuration
- I run activate.bat from a cmd window
- I execute the manage.py start command

And here's what the terminal is saying:

Code: Select all

D:\>D:\_ServeurTM\server\PyPlanet\env\Scripts\activate.bat

(env) D:\>cd \_ServeurTM\server\PyPlanet

(env) D:\_ServeurTM\server\PyPlanet>manage.py start
Traceback (most recent call last):
  File "D:\_ServeurTM\server\PyPlanet\manage.py", line 8, in <module>
    from pyplanet.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'pyplanet'

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

Traceback (most recent call last):
  File "D:\_ServeurTM\server\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?

(env) D:\_ServeurTM\server\PyPlanet>
Off course my server is started as well as Wamp for my database.

I do not understand what I did wrong. Maybe the configuration files are in the wrong place?
I may have omitted to configure something in the configuration files in the "settings" directory or maybe even in manage.py?

Should I run the "manage.py start" command from the terminal while in the environment, or in another window not in the environment?
In both cases I have the same error message.

Could you enlighten me on the way forward?
Tell me if you need any other information that could help you find the source of the problem.

While waiting for an answer, it will help me a lot.
Thanks in advance,

Pilax

PS :
- Python is installed on my C drive, defaut path installation.
- Trackmania Server path is D:\_ServeurTM\server\
- "env" directory path is D:\_ServeurTM\server\PyPlanet\
- "manage.py", "requirements.txt" and "settings" directory path is D:\_ServeurTM\server\PyPlanet\
If can help you.
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: Error When starting PyPlanet

Post by toffe »

Hey,

How did you install PyPlanet itself? Did you execute the pip install command inside the virtualenv (after you did the activate script)?
It looks like it doesn't find PyPlanet itself, which can be caused by a wrong or failed installation of PyPlanet.
Pilax
Posts: 17
Joined: 18 Jun 2017, 11:13

Re: Error When starting PyPlanet

Post by Pilax »

Hey,

Yes of course.
I created my folder called "PyPlanet" where I want to install Pyplanet.
I open a cmd, go to my folder, and type "virtualenv env".
So I have : d:\..\PyPlanet\env

Then, always in the cmd, I execute "activate.bat"
My prompt is on (env) d:\..\PyPlanet\env\
I type : pip install pyplanet --upgrade
All passed without error.
I see the file "pyplanet.exe" among others is present in d:\...\PyPlanet\env\Scripts\

It is from here that I had confusion in the documentation, when executing the command "pyplanet init_project ."
Remaining in the directory d:\...\PyPlant\env\, I have an error specifying that the directory is already present.
So I was able to execute the command from the directory d:\...\Pyplanet\, creating the directory "settings" and the files "requierements.txt" & "manage.py".

I tried to move these files into d:\...\PyPlanet\env\Scripts\, without succes, got the same error message quoted previously.

Here is where I am. If I can bring any other details do not hesitate, I will try to stay on discord tonight and tomorrow.

I had forgotten to specify on my initial post, that I had created the database and configure the files for connecting to it.

See you.
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: Error When starting PyPlanet

Post by toffe »

Ahh,
Well, you don't have to be in the env and scripts folder to execute the pyplanet init_project. The command is just to create scripts, configuration and such in the directory you want it to be in. The best is to create a new folder besides your env folder.

d:\..\PyPlanet\env will be your env and d:\..\PyPlanet is the root where you execute the init_project with a parameter of the subfolder it will create.
After this you can start with the manage.py file in this folder.

I will be on Discord later today, you can message me anyway and I'll reply when possible.

Toffe
Pilax
Posts: 17
Joined: 18 Jun 2017, 11:13

Re: Error When starting PyPlanet

Post by Pilax »

toffe wrote: 05 Nov 2017, 12:47 Ahh,
Well, you don't have to be in the env and scripts folder to execute the pyplanet init_project. The command is just to create scripts, configuration and such in the directory you want it to be in. The best is to create a new folder besides your env folder.
Yes, that's what I understood, that it allowed to generate the config files to be able to set up Pyplanet and save the configuration.
But suddenly the problem does not come from this I think.
I was confused at this level of the documentation and I was not sure where to run the command to generate the config files, but I thniks is ok right now.
toffe wrote: 05 Nov 2017, 12:47 d:\..\PyPlanet\env will be your env and d:\..\PyPlanet is the root where you execute the init_project with a parameter of the subfolder it will create.
After this you can start with the manage.py file in this folder.
In the end it's exactly what I have. A directory "Pylanet" in which I have the directories "env" and "settings", as well as the files "manage.py" and "requirements.txt".

I edited the files that are in the "settings" directory in order to configure Pyplanet.
I did not change anything in the "manage.py" file.
In cmd I execute "activate.bat" then "manage.py start", this is where I get the error message quote in my first post.
It is at this stage that I find myself stuck.

I stay on discord this afternoon, MP me when you can.
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: Error When starting PyPlanet

Post by toffe »

I've helped Pilax and the issues he had.
For other users having this issue, start PyPlanet on windows with the following command:

Code: Select all

python manage.py start
(the difference is the python in front).

Also, if you get the error about MySQL and index sizes 1000 bytes, change the database storage engine to InnoDB or the default storage engine of MySQL in your my.ini:

Code: Select all

default-storage-engine=InnoDB
Those things are lessons learned and will be in the updated docs as well.

Thanks,
Toffe
Pilax
Posts: 17
Joined: 18 Jun 2017, 11:13

Re: Error When starting PyPlanet

Post by Pilax »

Thank you very much for your help and your patience.

I hope that my case can help people with the same problem :)

See you later Toffe;)
Locked

Return to “PyPlanet”

Who is online

Users browsing this forum: No registered users and 2 guests