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

Twine command not working in windows #909

Open
jaxram opened this issue Jun 16, 2022 · 1 comment
Open

Twine command not working in windows #909

jaxram opened this issue Jun 16, 2022 · 1 comment
Labels
support Users asking for help using twine

Comments

@jaxram
Copy link

jaxram commented Jun 16, 2022

C:\Users\scr> twine


Traceback (most recent call last):
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\Scripts\twine.exe\__main__.py", line 7, in <module>
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\twine\__main__.py", line 33, in main
    error = cli.dispatch(sys.argv[1:])
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\twine\cli.py", line 91, in dispatch
    registered_commands = importlib_metadata.entry_points(
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\__init__.py", line 1027, in entry_points
    return SelectableGroups.load(eps).select(**params)
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\__init__.py", line 477, in load
    ordered = sorted(eps, key=by_group)
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\__init__.py", line 1024, in <genexpr>
    eps = itertools.chain.from_iterable(
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\_itertools.py", line 16, in unique_everseen
    k = key(element)
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\__init__.py", line 959, in _normalized_name
    return self._name_from_stem(stem) or super()._normalized_name
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\__init__.py", line 628, in _normalized_name
    return Prepared.normalize(self.name)
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\__init__.py", line 883, in normalize
    return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
  File "C:\Users\scr\AppData\Local\Programs\Python\Python310\lib\re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
@jaxram jaxram changed the title Twine not working Twine command not working in windows Jun 16, 2022
@bhrutledge
Copy link
Contributor

How did you install Twine? What version of Python are you using?

Take a look at #774, which is a similar issue, and includes some commands that might be useful for debugging. I'm guessing you've installed Twine into a Python environment that includes many other packages, and one of those packages has invalid metadata, causing importlib_metadata.entry_points() to fail. If that's the case, you should be able to resolve the issue by a) removing the invalid packages or b) using an isolated virtual environment for Twine, either manually with python3 -m venv or pipx.

@bhrutledge bhrutledge added the support Users asking for help using twine label Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Users asking for help using twine
Projects
None yet
Development

No branches or pull requests

2 participants