florisla / stm32loader

Flash firmware to STM32 microcontrollers using Python.
GNU General Public License v3.0
109 stars 53 forks source link

ModuleNotFoundError: No module named 'stm32loader' #49

Closed snoop911 closed 3 years ago

snoop911 commented 4 years ago

Pretty new to this, so most likely something on my end.. but I've installed via : pip install stm32loader

but in a Python 3.7 x32 shell, I can't seem to import or instantiate it. It always returns module not found, "ImportError: cannot import name 'bootloader' from 'stm32loader' (C:\Python\Python37_x32\lib\site-packages\stm32loader\__init__.py)"

I'm doing:

import stm32loader    

from stm32loader import __version__, bootloader
from stm32loader.uart import SerialConnection

Alternatively, according to the instructions on http://pypi.org/project/stm32loader/ it suggests the usage would be something like:

python stm32loader.py -p COM10 -e -w -v somefile.bin

However, I've unzipped "stm32loader-0.5.1.tar.gz" but don't see any stm32loader.py file.

Any pointers what I should try?
Thanks!

florisla commented 4 years ago

Hi,

Could you check the version number which is present in file C:\Python\Python37_x32\lib\site-packages\stm32loader\__init__.py. It should read something like

__version_info__ = (0, 5, 1)

Perhaps your 'pip install' was using another Python version than the one you ended up using.

You can try this:

py.exe -3.7 -m pip install --upgrade stm32loader
py.exe -3.7 -c "import stm32loader"

The instructions to use stm32loader.py are outdated. You should either use stm32loader as a module, or call the main.py file.

cd path\to\folder\which-contains-stm32loader-sufolder
py.exe -3.7 -m stm32loader -p COM10 -e -w -v somefile.bin
py.exe -3.7 stm32loader/main.py -p COM10 -e -w -v somefile.bin
florisla commented 3 years ago

Closing in favor of #52.