tgorgdotcom / locast2plex

A very simple script to connect locast to Plex's live tv/dvr feature.
MIT License
234 stars 43 forks source link

Unable to start Windows Service #93

Open Dakoyta opened 4 years ago

Dakoyta commented 4 years ago

Hello,

I keep having issues with running the windows service. I have been trying to get it to work for the last two hours. I have made a donation and followed the guide set by step multiple times, I have tried restarting the server, I have tried using the default IP address in the guide, local ip address, as well as actual ip address. No luck

When I create the service through nssm it creates successfully, however when I run it I get the following error:

https://ibb.co/41V9Mhj

Any help is greatly appricated!

tharris9d commented 4 years ago

Does it work when you run it from the commandline? I always test via commandline before creating the service. If there are any errors you will see them immediately. (for .5.2) In a bat/cmd file run [change paths as necessary] c:\python27\python.exe c:\code\locast2plex\main.py (for .4.2) add the parameters. Let me know how it goes. (FYI I use 127.0.0.1)

Drwoodr commented 3 years ago

I am having the same issue with the service not starting. I ran from the command line as suggested above, and it still doesn't run. I have everything in a DVR folder and used my PLEX server ip address: c:\DVR\Python\python.exe C:\DVR\locast2plex\main.py -u:userid@email.com -p:password --debug --addy:192.168.1.130 --port:6077 Service name is locast2plex

When I ran the above as a .bat file, I get this: c:\DVR>DVR.bat

c:\DVR>c:\DVR\Python\python.exe Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

so Python started, but the next line did not appear to run, so I entered it:

C:\DVR\locast2plex\main.py -u:userid@email.com -p:password --debug --addy:192.168.1.130 --port:6077 Service name is locast2plex File "", line 1 SyntaxError: unexpected character after line continuation character

tharris9d commented 3 years ago

It looks like you are using the wrong syntax. The python 3x version uses a config file. Put your info in the config.ini and just run main.py. You have to go back to the python 2.9 version to use the command-line arguments.

Drwoodr commented 3 years ago

I uninstalled 3.9 and looked for a 2.9 version on Python.org, but only saw 2.7, so I installed the most recent version I saw, 2.7.18. I get an invalid syntax error running from a command prompt, and the same original error when running in services.

tharris9d commented 3 years ago

Fyi: You can install multiple versions of Python on Windows. Check the code you are using to make sure it matches the Python version. Point to the the direct path in your batch file to test it.

Drwoodr commented 3 years ago

OK, getting closer I think. When I run the batch file, I get:

c:\DVR>C:\DVR\Python\python.exe C:\DVR\locast2plex\main.py -u:userid@email.com -p:password --debug --addy:192.168.1.130 --port:6077 Service name is locast2plex Traceback (most recent call last): File "C:\DVR\locast2plex\main.py", line 11, in import configparser ImportError: No module named configparser

Drwoodr commented 3 years ago

I finally see the issue, I did not realize that in addition to multiple Python versions working differently, the locast2plex files are also specific to a particular Python version. I had downloaded the most recent locast2plex version which is configured for Python3. If I understand this correctly, using Windows Services and setting up using nssm.exe using Python3, in you example the entry for Auguments should simply be C:\code\locast2plex\main.py, and the config.ini file will take care of the rest? What about the argument --debug ?