Opened 7 years ago
Last modified 7 years ago
#12757 closed defect
[Errno 2] No such file or directory when running tracd on Windows with --auto-reload — at Version 7
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.14 |
Component: | web frontend/tracd | Version: | 1.2dev |
Severity: | normal | Keywords: | windows |
Cc: | Branch: | ||
Release Notes: |
Fixed error starting |
||
API Changes: | |||
Internal Changes: |
Description
Running tracd
on windows with the -r
switch:
(pve) C:\Users\Ryan Ollos\trac-dev>tracd -r -s -p 8000 tracenv c:\users\ryanol~1\trac-dev\pve\scripts\python.exe: can't open file 'C:\Users \RYANOL~1\trac-dev\pve\Scripts\tracd': [Errno 2] No such file or directory
Behavior seen on 1.2-stable, I need to check if behavior occurs on 1.0-stable.
It works fine without the -r
switch, or when pointing to tracd-script.py
rather than tracd
:
-
trac-1.2-stable/trac/util/autoreload.py
63 63 def _restart_with_reloader(): 64 64 while True: 65 65 args = [sys.executable] + sys.argv 66 args[1] += '-script.py' 66 67 if sys.platform == 'win32': 67 68 args = ['"%s"' % arg for arg in args] 68 69 new_environ = os.environ.copy()
That's not a proposed change, just a demonstration of what works.
Change History (7)
comment:1 by , 7 years ago
Keywords: | wheel added |
---|
comment:2 by , 7 years ago
According to http://wheel.readthedocs.io/en/latest/#setuptools-scripts-handling, script files can be installed using wheel install-files NAME
.
C:\>C:\usr\var\venv\trac-1.0.13\Scripts\python.exe -m wheel install-scripts Trac==1.0.13 C:\>C:\usr\var\venv\trac-1.0.13\Scripts\python.exe Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> for _ in os.listdir(r'C:\usr\var\venv\trac-1.0.13\Scripts'): ... if 'script' in _: ... _ ... 'trac-admin-script.py' 'tracd-script.py' >>>
comment:3 by , 7 years ago
The issue I've reported is seen using develop mode with an egg
, not wheel
, and script files are installed. I've installed with python setup.py develop
.
The issue I'm reporting is only seen when using -r
/--auto-reload
.
(pve) C:\Users\Ryan Ollos\trac-dev>pip list --format=columns Package Version Location ---------- ---------- -------------------------------------------- appdirs 1.4.3 Genshi 0.7 packaging 16.8 pip 9.0.1 pyparsing 2.2.0 setuptools 34.3.3 six 1.10.0 Trac 1.2.2.dev0 c:\users\ryan ollos\trac-dev\trac-1.2-stable wheel 0.29.0 (pve) C:\Users\Ryan Ollos\trac-dev>dir pve\Scripts Volume in drive C has no label. Volume Serial Number is 6C99-BF6F Directory of C:\Users\Ryan Ollos\trac-dev\pve\Scripts 04/04/2017 08:49 PM <DIR> . 04/04/2017 08:49 PM <DIR> .. 04/04/2017 05:31 PM 2,195 activate 04/04/2017 05:31 PM 765 activate.bat 04/04/2017 05:31 PM 8,325 activate.ps1 04/04/2017 05:31 PM 1,137 activate_this.py 04/04/2017 05:31 PM 508 deactivate.bat 04/04/2017 05:31 PM 98,180 easy_install-2.7.exe 04/04/2017 08:49 PM 433 easy_install-3.6-script.py 04/04/2017 08:49 PM 74,752 easy_install-3.6.exe 04/04/2017 08:49 PM 425 easy_install-script.py 04/04/2017 08:49 PM 74,752 easy_install.exe 04/04/2017 05:31 PM 98,152 pip.exe 04/04/2017 05:31 PM 98,152 pip2.7.exe 04/04/2017 05:31 PM 98,152 pip2.exe 04/04/2017 05:31 PM 28,160 python.exe 04/04/2017 05:31 PM 28,160 pythonw.exe 04/04/2017 08:49 PM 403 trac-admin-script.py 04/04/2017 08:49 PM 74,752 trac-admin.exe 04/04/2017 08:49 PM 393 tracd-script.py 04/04/2017 08:49 PM 74,752 tracd.exe 04/04/2017 05:31 PM 98,159 wheel.exe 20 File(s) 860,707 bytes 2 Dir(s) 10,092,253,184 bytes free (pve) C:\Users\Ryan Ollos\trac-dev>tracd -r -s -p 8000 tracenv C:\Users\RYANOL~1\trac-dev\pve\Scripts\python.exe: can't open file 'C:\Users\RYA NOL~1\trac-dev\pve\Scripts\tracd': [Errno 2] No such file or directory 2 (pve) C:\Users\Ryan Ollos\trac-dev>tracd -s -p 8000 tracenv Server starting in PID 4044. Serving on 0.0.0.0:8000 view at http://127.0.0.1:8000/ Using HTTP/1.1 protocol version
Regarding the wheel behavior, see also gmessage:trac-dev:z6Vg8o0U5XA/zgJYzrREAAAJ.
comment:4 by , 7 years ago
Keywords: | wheel removed |
---|
comment:5 by , 7 years ago
Sorry for my noise. I consider we intentionally use only for development and debugging with -r
option of trac/web/standard.py
. I propose wontfix, otherwise prevent uses of -r
option in installed tracd
script.
See also Automatic reloading: For development: … in TracStandalone#Pros.
comment:6 by , 7 years ago
We could check whether sys.argv[0]
is existent and executable, and whether sys.argv[0] + '.exe'
is executable on Windows.
-
trac/util/autoreload.py
diff --git a/trac/util/autoreload.py b/trac/util/autoreload.py index c74441058..3e83fbff5 100644
a b def _reloader_thread(modification_callback, loop_callback): 62 62 63 63 def _restart_with_reloader(): 64 64 while True: 65 args = [sys.executable] + sys.argv 65 if os.path.isfile(sys.argv[0]): 66 args = sys.argv if os.access(sys.argv[0], os.X_OK) \ 67 else [sys.executable] + sys.argv 68 elif sys.platform == 'win32' and \ 69 os.access(sys.argv[0] + '.exe', os.X_OK): 70 args = [sys.argv[0] + '.exe'] + sys.argv[1:] 71 else: 72 args = [sys.executable] + sys.argv 73 path = args[0] 66 74 if sys.platform == 'win32': 67 75 args = ['"%s"' % arg for arg in args] 68 76 new_environ = os.environ.copy() … … def _restart_with_reloader(): 70 78 71 79 # This call reinvokes ourself and goes into the other branch of main as 72 80 # a new process. 73 exit_code = os.spawnve(os.P_WAIT, sys.executable, 74 args, new_environ) 81 exit_code = os.spawnve(os.P_WAIT, path, args, new_environ) 75 82 if exit_code != 3: 76 83 return exit_code 77 84
comment:7 by , 7 years ago
Milestone: | 1.2.2 → 1.0.14 |
---|---|
Owner: | set to |
Release Notes: | modified (diff) |
Status: | new → assigned |
Thanks, comment:6 change works well.
The same issue exists on Trac 1.0.13 but
tracd-script.py
isn't installed via wheel.tracd-script.py
is installed if Trac is installed via egg package using easy_install.