astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.82k stars 467 forks source link

OSError when running django-admin in cpython@3.12.x toolchain #1372

Open dgavrilov opened 2 months ago

dgavrilov commented 2 months ago

Steps to Reproduce

> rye init --script --py 3.12 --no-readme --private --no-import --virtual
> rye sync
> rye add django
> rye run django-admin startproject newproject

Expected Result

This error is observed only in cpython@3.12.x. It is not observed in cpython@3.11.x.

Actual Result

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\Projects\django-test\.venv\Scripts\django-admin.exe\__main__.py", line 8, in <module>
  File "D:\Projects\django-test\.venv\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "D:\Projects\django-test\.venv\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\Projects\django-test\.venv\Lib\site-packages\django\core\management\base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\Projects\django-test\.venv\Lib\site-packages\django\core\management\base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Projects\django-test\.venv\Lib\site-packages\django\core\management\commands\startproject.py", line 21, in handle
    super().handle("project", project_name, target, **options)
  File "D:\Projects\django-test\.venv\Lib\site-packages\django\core\management\templates.py", line 232, in handle
    run_formatters([top_dir], **formatter_paths)
  File "D:\Projects\django-test\.venv\Lib\site-packages\django\core\management\utils.py", line 172, in run_formatters
    subprocess.run(
  File "C:\Users\dgavrilov\.rye\py\cpython@3.12.5\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\dgavrilov\.rye\py\cpython@3.12.5\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\dgavrilov\.rye\py\cpython@3.12.5\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 is not a valid Win32 application

Version Info

rye 0.39.0
commit: 0.39.0 (bf3ccf818 2024-08-21)
platform: windows (x86_64)
self-python: cpython@3.12.3
symlink support: true
uv enabled: true

Stacktrace

No response