-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.8.0] Breaks esptool import due to esptool.py in Scripts instead of esptool.exe (ESPTOOL-924) #1010
Comments
we are running another exe in Scripts so suspect Scripts is inserted to sys.path |
ok. so its just python behaviour to add the cwd first to sys.path Can it be reverted back to exe? Also, for users who have setup .py files to open in editor by default, just typing esptool or esptool.py opens the file for editing :( |
Hi @matthuisman, I am confused a little by your report. You have several options how to run esptool:
Your report shows you've tried to install it as a Python package, but you keep mentioning
We haven't changed anything in this release and I don't fully understand what you mean by this. What version did you use before
Try running simply |
It has changed. pip install esptool now gives you esptool.py in Scripts
directory instead of esptool.exe
Which breaks importing esptool package as they share the same name
mkvirtualenv esptool
activate the env
pip install esptool
cd to the virtualenv Scripts directory
python -c "from esptool import ESPLoader"
ERROR:
ImportError: cannot import name 'ESPLoader' from 'esptool' (C:\Users\Matt\Envs\esptool\Scripts\esptool.py)
|
maybe due to change in release process? I notice previous releases are all .tar.gz but 4.8.0 uses a whl |
i tried cloning the source and then using the same python -m build What is intersting, the pypi whl published by your job has an extra .data directory that contains scripts and then the python scripts When i do python -m build locally, my whl does not have the .data/scripts dir and uses entry_points instead. Not sure what is different to your github build action to mine locally (maybe different setuptools version or some env variable changing behaviour? |
ok, if i build in ubuntu, i get the same result .data/scripts. |
OK, so the issue is https://github.com/espressif/esptool/blob/master/setup.py#L4 Your building the whl on ubuntu so its choosing the if os.name != "nt": path and using scripts instead of entry_points which causes the issue on Windows. I think you would need to publish a whl for windows and a whl for other platforms (if thats possible) |
PR created to use --sdist with build to avoid building non-universal whl |
Operating System
Windows
Esptool Version
4.8.0
Python Version
3.10
Full Esptool Command Line that Was Run
No response
Esptool Output
What is the Expected Behaviour?
Can import from esp module and use esptool.exe cmdline
More Information
setuptools 75.1.0
pip 24.2
wheel 0.44.0
Other Steps to Reproduce
the Scripts directory has to be before site-pages in sys.path

virtualenvs do that
The text was updated successfully, but these errors were encountered: