#8920 closed defect (fixed)
traceback on help in uninitialized environment
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | normal | Milestone: | 0.12 |
Component: | admin/console | Version: | 0.12dev |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
(virtlast) M:\p\python\trac\virtlast>trac-admin _testenv Welcome to trac-admin 0.12dev-r8987 Interactive Trac administration console. Copyright (c) 2003-2009 Edgewall Software Type: '?' or 'help' for help on commands. Trac [M:\p\python\trac\virtlast\_testenv]> ? trac-admin - The Trac Administration Console 0.12dev-r8987 Failed to open environment. (2, 'No such file or directory') Traceback (most recent call last): File "m:\p\python\trac\trac-0.12dev\trac\admin\console.py", line 157, in env self.__env = Environment(self.envname) File "m:\p\python\trac\trac-0.12dev\trac\env.py", line 214, in __init__ self.verify() File "m:\p\python\trac\trac-0.12dev\trac\env.py", line 285, in verify fd = open(os.path.join(self.path, 'VERSION'), 'r') IOError: [Errno 2] No such file or directory: 'M:\\p\\python\\trac\\virtlast\\_testenv\\VERSION'
Attachments (2)
Change History (13)
comment:1 by , 15 years ago
Milestone: | 0.12 → 0.12.1 |
---|---|
Owner: | set to |
comment:2 by , 15 years ago
Exactly. I actually wanted to get help on "initenv" command before issuing it with all required params.
comment:3 by , 15 years ago
You can use trac-admin help initenv
(i.e. without specifying the environment).
comment:4 by , 15 years ago
I think that the line
Failed to open environment. (2, 'No such file or directory')
provides sufficient information, so that we actually could close this, or, alternatively:
create the environment.
comment:5 by , 15 years ago
Actually, this seems to be far more complex, as arbitrary commands entered will lead to exception traces such as below:
Trac [/tmp/test]> ragga Failed to open environment. (2, 'No such file or directory') Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/admin/console.py", line 158, in env self.__env = Environment(self.envname) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/env.py", line 216, in __init__ self.verify() File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/env.py", line 295, in verify fd = open(os.path.join(self.path, 'VERSION'), 'r') IOError: [Errno 2] No such file or directory: '/tmp/test/VERSION' AttributeError: 'NoneType' object has no attribute 'components' Failed to open environment. (2, 'No such file or directory') Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/admin/console.py", line 158, in env self.__env = Environment(self.envname) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/env.py", line 216, in __init__ self.verify() File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/env.py", line 295, in verify fd = open(os.path.join(self.path, 'VERSION'), 'r') IOError: [Errno 2] No such file or directory: '/tmp/test/VERSION' Traceback (most recent call last): File "/usr/local/bin/trac-admin", line 8, in <module> load_entry_point('Trac==0.12dev-r0', 'console_scripts', 'trac-admin')() File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/admin/console.py", line 542, in run admin.run() File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/admin/console.py", line 135, in run self.cmdloop() File "/usr/lib/python2.6/cmd.py", line 142, in cmdloop stop = self.onecmd(line) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r0-py2.6.egg/trac/admin/console.py", line 122, in onecmd self.env.log.error("Exception in trac-admin command: %s", AttributeError: 'NoneType' object has no attribute 'log'
follow-up: 7 comment:6 by , 15 years ago
I would propose that when invoking trac with a non existing location or a location that is not a trac environment (whatever the criterias for this would be) will abort the operation and yield an appropriate message such as "Please use 'trac-admin <env-path> initenv' for initializing the environment first.".
comment:7 by , 15 years ago
Replying to Carsten Klein <carsten.klein@…>:
I would propose that when invoking trac with a non existing location or a location that is not a trac environment (whatever the criterias for this would be) will abort the operation and yield an appropriate message such as "Please use 'trac-admin <env-path> initenv' for initializing the environment first.".
in case of an existing, non-empty location the operation should be aborted with an error message such as
"The specified location is not a trac environment." or something similar.
comment:9 by , 15 years ago
Here is a corrected version of the patch. The former would cause trac-admin to stop working. Yet, when first integrating it, it seemed to work fine…
comment:10 by , 15 years ago
Milestone: | 0.12.1 → 0.12 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
The proper fix was a bit more involved, see [9400].
comment:11 by , 15 years ago
Oh dear me, the previous patch did not do it, except preventing new environments from being created.
However, I found a solution, checking for 'initenv' not in args, but your solution seems more elaborate.
Thanks for working this out, great job!
You mean,
_testenv
doesn't exist yet? That's a bit cosmetic, but yeah, it should give a more useful message.