glasgow: running Glasgow exectutable produces "TypeError: expected string or bytes-like object" in packaging\utils.py
The example below is a build command but even just running Glasgow without any arguments, produces the same error. I updated to commit 62e27d9941bf22d1fdb73681af7eb74e96be775a. This is still on python 3.9.
PS C:\Users\Tiago\Documents\Git> glasgow build --rev C3 uart
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\users\tiago\.local\bin\glasgow.exe\__main__.py", line 7, in <module>
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\cli.py", line 910, in main
exit(loop.run_until_complete(_main()))
File "c:\python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\cli.py", line 490, in _main
args = get_argparser().parse_args()
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\cli.py", line 283, in get_argparser
add_applet_arg(p_run, mode="interact", required=True)
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\cli.py", line 128, in add_applet_arg
for handle, metadata in GlasgowAppletMetadata.all().items():
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\support\plugin.py", line 87, in all
return {ep.name: cls(ep) for ep in _entry_points(group=cls.GROUP_NAME)}
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\support\plugin.py", line 87, in <dictcomp>
return {ep.name: cls(ep) for ep in _entry_points(group=cls.GROUP_NAME)}
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\support\plugin.py", line 97, in __init__
self.requirements = _requirements_for_optional_dependencies(
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\support\plugin.py", line 31, in _requirements_for_optional_dependencies
if requirement.marker and requirement.marker.evaluate({"extra": dependency}):
File "C:\Users\Tiago\.local\pipx\venvs\glasgow\lib\site-packages\packaging\markers.py", line 252, in evaluate
return _evaluate_markers(self._markers, current_environment)
File "C:\Users\Tiago\.local\pipx\venvs\glasgow\lib\site-packages\packaging\markers.py", line 157, in _evaluate_markers
lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key)
File "C:\Users\Tiago\.local\pipx\venvs\glasgow\lib\site-packages\packaging\markers.py", line 131, in _normalize
return tuple(canonicalize_name(v) for v in values)
File "C:\Users\Tiago\.local\pipx\venvs\glasgow\lib\site-packages\packaging\markers.py", line 131, in <genexpr>
return tuple(canonicalize_name(v) for v in values)
File "C:\Users\Tiago\.local\pipx\venvs\glasgow\lib\site-packages\packaging\utils.py", line 47, in canonicalize_name
value = _canonicalize_regex.sub("-", name).lower()
TypeError: expected string or bytes-like object
I did try forcing it to be string in plugin.py:
if requirement.marker and requirement.marker.evaluate({"extra": str(dependency)}):
but after doing so I get an issue with the aiohttp dependency (so I don’t know if this was the right thing to do):
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\applet\audio\yamaha_opx\__init__.py", line 143, in <module>
import aiohttp, aiohttp.web
ModuleNotFoundError: No module named 'aiohttp'
Here is the full trace:
PS C:\Users\Tiago\Documents\Git> glasgow.exe --version
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\users\tiago\.local\bin\glasgow.exe\__main__.py", line 7, in <module>
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\cli.py", line 910, in main
exit(loop.run_until_complete(_main()))
File "c:\python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\cli.py", line 490, in _main
args = get_argparser().parse_args()
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\cli.py", line 283, in get_argparser
add_applet_arg(p_run, mode="interact", required=True)
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\cli.py", line 128, in add_applet_arg
for handle, metadata in GlasgowAppletMetadata.all().items():
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\support\plugin.py", line 87, in all
return {ep.name: cls(ep) for ep in _entry_points(group=cls.GROUP_NAME)}
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\support\plugin.py", line 87, in <dictcomp>
return {ep.name: cls(ep) for ep in _entry_points(group=cls.GROUP_NAME)}
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\support\plugin.py", line 103, in __init__
self._cls = entry_point.load()
File "c:\python39\lib\importlib\metadata.py", line 77, in load
module = import_module(match.group('module'))
File "c:\python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\Tiago\Documents\Git\glasgow\software\glasgow\applet\audio\yamaha_opx\__init__.py", line 143, in <module>
import aiohttp, aiohttp.web
ModuleNotFoundError: No module named 'aiohttp'
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 21 (8 by maintainers)
Commits related to this issue
- Python 3.9 importlib.metadata extras is a re.Match Coerce each entry to be a a string, so we can use to check requirements. See https://github.com/GlasgowEmbedded/glasgow/issues/422 — committed to ewenmcneill/glasgow by ewenmcneill 9 months ago
- support.plugin: add workaround for defect in Python 3.9 <3.9.11. Fixes #422. — committed to whitequark/glasgow by whitequark 9 months ago
- support.plugin: add workaround for defect in Python 3.9 <3.9.11. Fixes #422. — committed to whitequark/glasgow by whitequark 9 months ago
- support.plugin: add workaround for defect in Python 3.9 <3.9.11. Fixes #422. — committed to whitequark/glasgow by whitequark 9 months ago
- support.plugin: add workaround for defect in Python 3.9 <3.9.11. Fixes #422. — committed to whitequark/glasgow by whitequark 9 months ago
- support.plugin: add workaround for defect in Python 3.9 <3.9.11. Fixes #422. — committed to whitequark/glasgow by whitequark 9 months ago
- support.plugin: add workaround for defect in Python 3.9 <3.9.11. Fixes #422. — committed to whitequark/glasgow by whitequark 9 months ago
- support.plugin: add workaround for defect in Python 3.9 <3.9.11. Fixes #422. — committed to GlasgowEmbedded/glasgow by whitequark 9 months ago
Reach heaven by violence. https://github.com/GlasgowEmbedded/glasgow/pull/436
Good/bad:
3.9.x3.9.5bad (see Ubuntu 20.04 LTS)3.9.9bad3.9.10bad3.9.11good3.9.12good3.10.x3.10.1bad3.10.2bad3.10.3goodI can confirm that the above fix works to fix this specific issue,
glasgow --versionnow works again.glasgow build --rev C3 uartdoes not, but that is a bug which is probably windows specific. I’ll open a new report for that.