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

_Py_HashRandomization_Init fails on windows #3

Open
theAeon opened this issue Apr 4, 2022 · 1 comment
Open

_Py_HashRandomization_Init fails on windows #3

theAeon opened this issue Apr 4, 2022 · 1 comment

Comments

@theAeon
Copy link

theAeon commented Apr 4, 2022

Running the generated command manually (without non-interactive, of course) works fine, invoking thru pdm-publish raises the following error,

 - Adding scikit_bio_parasail-0.0.1.dist-info/RECORD
Built wheel at C:/Users/andre/source/scikit-bio-parasail/dist\scikit_bio_parasail-0.0.1-py3-none-any.whl
Publish failed
Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python
Python runtime state: preinitialized


Traceback (most recent call last):
  File "C:\Users\andre\scoop\apps\python\current\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\andre\scoop\apps\python\current\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\andre\scoop\apps\pdm\current\venv\Scripts\pdm.exe\__main__.py", line 7, in <module>
  File "C:\Users\andre\scoop\apps\pdm\1.13.6\venv\lib\site-packages\pdm\core.py", line 233, in main
    return Core().main(args)
  File "C:\Users\andre\scoop\apps\pdm\1.13.6\venv\lib\site-packages\pdm\core.py", line 168, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "C:\Users\andre\scoop\apps\pdm\1.13.6\venv\lib\site-packages\pdm\core.py", line 163, in main
    f(options.project, options)
  File "C:\Users\andre\scoop\apps\pdm\1.13.6\venv\lib\site-packages\pdm_publish\command.py", line 74, in handle
    publisher.publish(
  File "C:\Users\andre\scoop\apps\pdm\1.13.6\venv\lib\site-packages\pdm_publish\core.py", line 49, in publish
    resp.check_returncode()
  File "C:\Users\andre\scoop\apps\python\current\lib\subprocess.py", line 456, in check_returncode
    raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command '['C:\\Users\\andre\\scoop\\apps\\pdm\\1.13.6\\venv\\Scripts\\python.exe', '-m', 'twine', 'upload', '--non-interactive', '--repository', 'pypi', '--username', '__token__', 'C:\\Users\\andre\\source\\scikit-bio-parasail\\dist\\scikit_bio_parasail-0.0.1-py3-none-any.whl', 'C:\\Users\\andre\\source\\scikit-bio-parasail\\dist\\scikit-bio-parasail-0.0.1.tar.gz']' returned non-zero exit status 1.

@vitidev
Copy link

vitidev commented Jun 29, 2022

This is bug of subrpocess.run on windows

pdm_publish\core.py must be rewrited from

with self.ui.open_spinner(f"Uploading to {repo}") as spin:
    resp = twine(
        "upload",
        "--non-interactive",
        f"--repository{repo_flag_suffix}",
        repo,
        "--username",
        username,
        *self.files,
        env={"TWINE_PASSWORD": password},
    )

to

with self.ui.open_spinner(f"Uploading to {repo}") as spin:
    env = os.environ
    env.update({'TWINE_PASSWORD': password})
    resp = twine(
        "upload",
        "--non-interactive",
        f"--repository{repo_flag_suffix}",
        repo,
        "--username",
        username,
        *self.files,
        env=env,
    )

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

No branches or pull requests

2 participants