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

[v5.1][idf.py] getidf: @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path()) No such file or directory (IDFGH-10210) #11476

Closed
chipweinberger opened this issue May 23, 2023 · 7 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@chipweinberger
Copy link
Contributor

chipweinberger commented May 23, 2023

IDF version.

release/v5.1

Operating System used.

macOS 13.3.1

How did you build your project?

Command line with idf.py

What is the expected behavior?

I am trying to run get_idf

What is the actual behavior?

It completes, but then crashes.

Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

Traceback (most recent call last):
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 767, in <module>
    main()
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 695, in main
    cli = init_cli(verbose_output=checks_output)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 620, in init_cli
    @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path())
                                                 ^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory
charlesweinberger@Chips-Macbook-Pro-2 jamcorder_app % idf.py build    
Traceback (most recent call last):
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 767, in <module>
    main()
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 695, in main
    cli = init_cli(verbose_output=checks_output)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 620, in init_cli
    @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path())

Steps to reproduce.

Not entirely sure, It was not doing this before. It happend after I emptied my trash bin, I think. Or maybe i trashed trying to fix something related to this. Hard to remember.

Build or installation Logs.

charlesweinberger@Chips-Macbook-Pro-2 jamcorder_app % getidf
Detecting the Python interpreter
Checking "python3" ...
Python 3.11.3
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
WARNING: tool cmake found in path, but returned non-zero exit code (1) with error message:
Current working directory cannot be established.

WARNING: tool cmake version 3.24.0 is installed, but returned non-zero exit code (1) with error message:
Current working directory cannot be established.

Adding ESP-IDF tools to PATH...
WARNING: tool cmake found in path, but returned non-zero exit code (1) with error message:
Current working directory cannot be established.

WARNING: tool cmake version 3.24.0 is installed, but returned non-zero exit code (1) with error message:
Current working directory cannot be established.

Checking if Python packages are up to date...
Constraint file: /Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/espidf.constraints.v5.1.txt
Requirement files:
 - /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/requirements/requirements.core.txt
Python being checked: /Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/python_env/idf5.1_py3.11_env/bin/python
Python requirements are satisfied.
Updated PATH variable:
  /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/espcoredump:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/partition_table:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/app_update:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/espcoredump:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/partition_table:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/app_update:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/xtensa-esp-elf-gdb/12.1_20221002/xtensa-esp-elf-gdb/bin:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/bin:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/python_env/idf5.1_py3.11_env/bin:/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Volumes/User/MBP-Google-Drive/jamcorder/app/flutter/bin:/Volumes/User/MBP-Google-Drive/jamcorder/app/flutter/.pub-cache/bin

Detected installed tools that are not currently used by active ESP-IDF version.
For removing old versions of riscv32-esp-elf, cmake, xtensa-esp32-elf, esp32s2ulp-elf, openocd-esp32, esp32ulp-elf, esp-rom-elfs, xtensa-esp-elf-gdb, xtensa-esp32s3-elf, xtensa-esp32s2-elf, riscv32-esp-elf-gdb use command 'python /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf_tools.py uninstall'
To free up even more space, remove installation packages of those tools. Use option 'python3 /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf_tools.py uninstall --remove-archives'.

Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

Traceback (most recent call last):
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 767, in <module>
    main()
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 695, in main
    cli = init_cli(verbose_output=checks_output)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 620, in init_cli
    @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path())
                                                 ^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory
charlesweinberger@Chips-Macbook-Pro-2 jamcorder_app % idf.py build    
Traceback (most recent call last):
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 767, in <module>
    main()
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 695, in main
    cli = init_cli(verbose_output=checks_output)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/idf.py", line 620, in init_cli
    @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path())

More Information.

Every command is hitting this issue right now. I've cleaned /build manually, but still same issue.

@chipweinberger chipweinberger added the Type: Bug bugs in IDF label May 23, 2023
@github-actions github-actions bot changed the title [v5.1] @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path()) No such file or directory [v5.1] @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path()) No such file or directory (IDFGH-10210) May 23, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label May 23, 2023
@chipweinberger
Copy link
Contributor Author

chipweinberger commented May 23, 2023

Solution: Fixed by closing Terminal and reopening it.

I'll leave this issue open for others to find. Hopefully we can determine root cause.

@chipweinberger chipweinberger changed the title [v5.1] @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path()) No such file or directory (IDFGH-10210) [v5.1] getidf: @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path()) No such file or directory (IDFGH-10210) May 23, 2023
@chipweinberger chipweinberger changed the title [v5.1] getidf: @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path()) No such file or directory (IDFGH-10210) [v5.1][idf.py] getidf: @click.option('-C', '--project-dir', default=os.getcwd(), type=click.Path()) No such file or directory (IDFGH-10210) May 23, 2023
@dobairoland
Copy link
Collaborator

By get_idf you mean the alias suggested here?

If you get this the next time I would suggest to run . $IDF_PATH/export.sh directly in the same terminal to see if that helps. That would confirm that this is a shell environment issue (or not).

If you get this again then we can re-open it. For now, I don't think others would be affected. We haven't changed anything related to this for quite long time. So I'm closing this.

@igrr
Copy link
Member

igrr commented May 23, 2023

To reproduce:

$ mkdir /tmp/test
$ cd /tmp/test
# in another terminal:
$ rm -rf /tmp/test
# back to the first terminal
$ . /path/to/esp-idf/export.sh

not sure we need to fix this, though: a lot of other programs also misbehave the same way when you yank the CWD...
(e.g. Current working directory cannot be established. errors in the log)

@chipweinberger
Copy link
Contributor Author

chipweinberger commented May 23, 2023

By get_idf you mean the alias suggested here?

yes

If you get this again then we can re-open it.

yes. I think that is fair. I don't think I would fix it either. But I always file for google-ability!

@dobairoland
Copy link
Collaborator

Yes, you are right @igrr. I can reproduce that way.

Than running anything produces the same issue:

cmake --version
Current working directory cannot be established.

@chipweinberger
Copy link
Contributor Author

chipweinberger commented May 23, 2023

cmake does log a nice error message though ;)

that said backtraces are usually more useful. Maybe "os.getcwd failed. Has the current directory been deleted?"

The odd thing was that my current directory was not deleted. I confirmed. It existed in Finder. So it could have been a terminal bug. It was strange.

@dobairoland
Copy link
Collaborator

It is interesting that pwd still works:

.-(/tmp/test)---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`--> python -c 'import os; print(os.getcwd())'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory
.-(/tmp/test)---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`--> pwd
/tmp/test

So I guess any fix could be done only at idf.py.

We will take a closer look at this.

@dobairoland dobairoland reopened this May 23, 2023
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels May 26, 2023
@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable Resolution: Done Issue is done internally and removed Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable labels Jun 9, 2023
espressif-bot pushed a commit that referenced this issue Jun 14, 2023
Added check for existence of current working directory when using idf.py

Closes #11476
espressif-bot pushed a commit that referenced this issue Jul 7, 2023
Added check for existence of current working directory when using idf.py

Closes #11476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

5 participants