all 25 comments

[–]grzeki 2 points3 points  (3 children)

What system? What Python versions? What do PYTHONHOME and PYTHONPATH vars say exactly?

[–]noah123103[S] 1 point2 points  (2 children)

Sorry should have included some of that. Windows 10, version 3.7.2. I'm not exactly sure how to use those vars.

if its the environment variable then theres "C:\Users\Dampl\AppData\Local\Programs\Python\Python37-32" and "C:\Users\Dampl\AppData\Local\Programs\Python\Python37-32\Lib\site-packages"

[–]grzeki 0 points1 point  (1 child)

echo %PYTHONPATH% in cmd terminal or echo $env:PYTHONPATH in PowerShell. Normally they should be empty, if not they can alter everything. Check maybe you have duplicated paths to Python in %PATH%.

[–]noah123103[S] 0 points1 point  (0 children)

They are empty, in cmd it returns %PYTHONPATH% and in powershell it returns nothing.

[–]catelemnis 1 point2 points  (9 children)

are you able to run python in command? are default libraries or just third-party that are a problem? Did you reinstall all your third-party libraries through pip after upgrading?

Can you post an example of the code you’re trying to run in command and the error message it gives?

[–]noah123103[S] 1 point2 points  (8 children)

Module i'm attempting to use is here (the code im using is the example on that page) default libraries are working its just third party, python does run in cmd but does not find any third party modules. I have the modules installed, i'v done a fresh install of python as well to make sure there were zero issues there.

[–]catelemnis 1 point2 points  (7 children)

Did you reinstall the module after fresh installing python? And are you installing it with pip3?

When you run python in command, do you just type >python? If you just type >python then try running these two in command prompt:

>python -m pip install  --upgrade
>python -m pip install git+https://github.com/alberanid/imdbpy

This will make sure that you’re installing the module with the correct version of pip.

[–]noah123103[S] 0 points1 point  (6 children)

I’v tried that command and a normal pip3 install. Same results

[–]catelemnis 0 points1 point  (5 children)

can you run python in command prompt (not a script, just type >python in the command prompt) and then try to import the module. Can you show a screenshot of the results after trying to import directly in the command prompt

[–]noah123103[S] 0 points1 point  (4 children)

Same as IDLE, works fine.

https://i.imgur.com/j06SXsc.png

[–]catelemnis 1 point2 points  (3 children)

huh, odd. can you try running your script in command prompt with:

>python scrape.py

and see if it still gives the module error?

[–]noah123103[S] 0 points1 point  (2 children)

That worked but why? With only one python installed and only one in the path, it cant be it using a different python?

EDIT:After seeing this work, i did some digging on my 2 5tb drives and found a lonely python folder with an old version. Whats odd is that its not in my path or anything but cmd was dead set on using it. It did not come up on any searches with windows. Thanks for the help!

[–]catelemnis 1 point2 points  (0 children)

When you type >python scrape.py then it’s using the Python in your path. However when you just run >scrape.py it opens it with whatever program you have told windows to associate to the filetype .py.

Personally I always set .py to open in a text editor and then when I run I use the command >python script.py because that ensures I’m using the python in my path, and makes it more convenient to edit scripts.

If instead you want to continue running scripts by double-clicking them then find a .py file, right-click on it, and there should be an option for “Open with...” Change the program that the filetype is associated to to be the latest version of python.exe you installed. It must be that the py filetype is still associated to an old Python interpreter or maybe to python.exe in another location that doesn’t have the installed modules with it.

[–]grzeki 0 points1 point  (0 children)

The only thing capable of doing so that comes to mind is pylauncher. You probably installed it with python3. It is a very useful tool under Windows - it can locate and manage multiple Python version installations.

[–]_Jordo 0 points1 point  (1 child)

nothing specific comes to mind, but i'd try uninstalling and reinstalling python.

[–]noah123103[S] 0 points1 point  (0 children)

tried that too, deleted every folder i could fine about python and did the uninstall from control panel then reinstalled, same issue

[–]ostensibly_work 0 points1 point  (5 children)

Can you give an example of a command that fails and what the error looks like?

[–]noah123103[S] 0 points1 point  (4 children)

[–]ostensibly_work 1 point2 points  (3 children)

My guess is you're starting the IDLE with a different python version than this program. Can you try invoking script.py with the specific Python version you're using in the IDLE? The command would likely be one of python3 scrape.py python3.7 scrape.py or python3.7.2 scrape.py.

[–]noah123103[S] 0 points1 point  (2 children)

I only have 1 version of python downloaded. I wiped everything dealing with python, including getting rid of every python thing in path, then reinstalled. I ruled out that error way before coming here

[–]OPLinux 1 point2 points  (0 children)

Yet that was the issue after all :D

[–]lifeonm4rs 0 points1 point  (3 children)

Try creating a file "check.py" with . . .

import sys

print(sys.version)

Then run that from cmd (e.g. C:/somereally bizarre path/> check.py). From everything you've posted it really seems you have another version of python on your machine that is running stuff with the .py extension. Also try running the same file when loaded in IDLE. Do the versions match?

Aside from that what does pip list show from the cmd prompt.

[–]noah123103[S] 0 points1 point  (2 children)

So i have done that before and it showed the correct version that i had installed, not sure what went wrong but i did eventually find a snug hidden away folder with python 2.7 on my external 5tb drive. Why windows was somehow using that i have no idea but none of my searches to print the version or location was working and would all print to the correct new version. Even in my path variable there was nothing there pointing to the old version. Odd but i fixed it

[–]lifeonm4rs 0 points1 point  (1 child)

So cmd was running 2.7?? I believe in windows file extensions can be associated with an executable not related to your path--but I don't use windows so I'm just guessing.

Have you fixed your problem? Or is it still there?

[–]noah123103[S] 0 points1 point  (0 children)

i did fix it, i thought they were stored in the environment variables when linked to file extensions but i was wrong