cmathews393 / spotify-to-plex

A python script/app to sync Spotify Playlists into Plex (optionally via Lidarr)
GNU General Public License v3.0
34 stars 3 forks source link

NameError: name 'main' is not defined #15

Closed jl94x4 closed 8 months ago

jl94x4 commented 8 months ago

When running the app I get the following;;

Traceback (most recent call last): File "/usr/bin/py", line 167, in <module> result = eval(args.expression) File "<string>", line 1, in <module> main.py NameError: name 'main' is not defined

I've filled out the .env file, but not sure what next as I get the above error when running.

cmathews393 commented 8 months ago

Can you show me how you're running the file? This seems like an issue with your python environment or how you're running the script, but maybe I'm missing something @jl94x4

jl94x4 commented 8 months ago

py main.py

cmathews393 commented 8 months ago

Are you running from current-version or the parent dir?

jl94x4 commented 8 months ago

Current-version folder

cmathews393 commented 8 months ago

Can you run "py --version" for me?

jl94x4 commented 8 months ago

py --version Pythonpy ??? Python 3.10.12

cmathews393 commented 8 months ago

Can you try "python3 main.py"?

jl94x4 commented 8 months ago

python3 main.py Initiating Plex connection... Plex connection succeeded Initiating Spotify Connection Spotify connection succeeded Getting synced Lidarr playlists... Playlists grabbed ['37i9dQZF1E35ZCpaXlJL9l', '37i9dQZF1E369snZ4vCAsJ', '37i9dQZF1E37SnRieJ96Ov', '37i9dQZF1E37bCR6dnzXhj', '37i9dQZF1E38tViStP0eOU', '37i9dQZEVXbpgcowmWGpgY', '37i9dQZF1DX4W3aJJYCDfV', '3QzfkDvClpv27CKf7yLqfw', '2UEOUte7eCBdNYOOI7xizf', '37i9dQZF1E37SnRieJ96Ov', '7aCiVQAMMj91eXMac3u6BT'] Traceback (most recent call last): File "/home/ubuntu/spotify-to-plex/current-version/main.py", line 111, in <module> main() File "/home/ubuntu/spotify-to-plex/current-version/main.py", line 99, in main userlist = config("USERS").split(",") if config("USERS") else [] File "/home/ubuntu/.local/lib/python3.10/site-packages/decouple.py", line 248, in __call__ return self.config(*args, **kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/decouple.py", line 107, in __call__ return self.get(*args, **kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/decouple.py", line 92, in get raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option)) decouple.UndefinedValueError: USERS not found. Declare it as envvar or define a default value.

cmathews393 commented 8 months ago

Can you show me your env?

cmathews393 commented 8 months ago

Regardless of what you've got in there, my recommendation is to grab the latest version of the repo, and then recreate your .env based on the latest "default.env". I've made some changes that might be causing your issue, namely having USERS defined, even if empty, is required in the env. I may have pushed a commit that changed that requirement without updating the default.env. Also, if you use docker, I just pushed an update with a dockerfile, and there is a docker image on dockerhub that should resolve most people's compatibility issues.

cmathews393 commented 8 months ago

Closing, can't reproduce, provided workaround/solution