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

mbed-tools deploy fails while parsing .lib files #318

Open
nat45928 opened this issue Oct 8, 2021 · 1 comment
Open

mbed-tools deploy fails while parsing .lib files #318

nat45928 opened this issue Oct 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@nat45928
Copy link

nat45928 commented Oct 8, 2021

Describe the bug
It appears while searching for .lib files mbed-tools is able to traverse into tooling folders, namely a co-located virtualenv and attempts to parse invalid .lib files.

The exact traceback is:

> mbed-tools deploy
Checking out all libraries to revisions specified in .lib files. Resolving any unresolved libraries.
Traceback (most recent call last):
  File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files\python38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\myfiles\firmware\.venv\Scripts\mbed-tools.exe\__main__.py", line 7, in <module>
  File "d:\myfiles\firmware\.venv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "d:\myfiles\firmware\.venv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "d:\myfiles\firmware\.venv\lib\site-packages\mbed_tools\cli\main.py", line 38, in invoke
    super().invoke(context)
  File "d:\myfiles\firmware\.venv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "d:\myfiles\firmware\.venv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "d:\myfiles\firmware\.venv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "d:\myfiles\firmware\.venv\lib\site-packages\mbed_tools\cli\project_management.py", line 83, in deploy
    deploy_project(root_path, force)
  File "d:\myfiles\firmware\.venv\lib\site-packages\mbed_tools\project\project.py", line 70, in deploy_project
    libs.fetch()
  File "d:\myfiles\firmware\.venv\lib\site-packages\mbed_tools\project\_internal\libraries.py", line 65, in fetch
    git_ref = lib.get_git_reference()
  File "d:\myfiles\firmware\.venv\lib\site-packages\mbed_tools\project\_internal\libraries.py", line 46, in get_git_reference
    raw_ref = raw_bytes.decode('utf-8').strip()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 71: invalid start byte

In my case it appears to be parsing the file .venv\Lib\site-packages\win32\libs\pywintypes.lib.

To Reproduce

  1. Create a virtual env in .venv
  2. Install mbed-tools with a local mbed-os.lib file
  3. Run mbed-tools deploy

Expected behavior
mbed-tools deploy should execute.

Screenshots
NA

Desktop (please complete the following information):

  • OS: Windows
  • Version: 10

Mbed (please complete the following information):

  • Device: NUCLEO_F767ZI
  • Mbed OS Version: #4587080dbb470294f623054db2a272f1570be327
  • Mbed CLI 2 Version: 7.40.0

Additional context
NA

@nat45928 nat45928 added the bug Something isn't working label Oct 8, 2021
@BioBox
Copy link

BioBox commented Sep 13, 2022

Why are you using a python virtual environment in your mbed project folder when all the code is in C++? Just store your .venv folder somewhere else or better yet, don't use a virtual environment at all. Problem solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants