Skip to content
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

Open
matthuisman opened this issue Sep 19, 2024 · 7 comments

Comments

@matthuisman
Copy link

matthuisman commented Sep 19, 2024

Operating System

Windows

Esptool Version

4.8.0

Python Version

3.10

Full Esptool Command Line that Was Run

No response

Esptool Output

from esptool import get_default_connected_device, ESPLoader, DEFAULT_CONNECT_ATTEMPTS
ImportError: cannot import name 'get_default_connected_device' from 'esptool' (\\?\C:\Users\matt\Envs\py310\Scripts\esptool.py)

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
image

@github-actions github-actions bot changed the title [4.8.0] Breaks esptool import due to esptool.py in Scripts instead of esptool.exe [4.8.0] Breaks esptool import due to esptool.py in Scripts instead of esptool.exe (ESPTOOL-924) Sep 19, 2024
@matthuisman
Copy link
Author

we are running another exe in Scripts so suspect Scripts is inserted to sys.path

@matthuisman
Copy link
Author

ok. so its just python behaviour to add the cwd first to sys.path
So when our other console script in Scripts runs, python is inserting the Scripts dir to sys.path
And due to esptool.py having same name as the module - its finding the cmdline script

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 :(
Need to do python esptool.py ... now

@radimkarnis
Copy link
Collaborator

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 esptool.exe.

Can it be reverted back to exe?

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 v4.8.0?

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

Try running simply esptool (not esptool.py) on windows.

@matthuisman
Copy link
Author

matthuisman commented Sep 20, 2024 via email

@matthuisman
Copy link
Author

4.8.dev5 works ok
image

4.8.0 does not
image

@matthuisman
Copy link
Author

matthuisman commented Sep 20, 2024

maybe due to change in release process?
eacc94a

I notice previous releases are all .tar.gz but 4.8.0 uses a whl

@matthuisman
Copy link
Author

if I use
pip install esptool==4.8 --no-binary :all:
to force it to ignore the whl, then it builds correctly and has the correct exes (no bug)
image

So the issue is just in the published whl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants