#2229 closed defect (fixed)
Error when trying to run upgrade
Reported by: | erik.sundstrom | Owned by: | Russ Tyndall |
---|---|---|---|
Priority: | normal | Component: | TimingAndEstimationPlugin |
Severity: | blocker | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
Trying to upgrade, but it fails, I have installed latest version of Genshi and have the plugin enabled before upgrading.. :
C:\Python24\Scripts>trac-admin c:\Python24\Scripts\trac\TracTemplateTime Welcome to trac-admin 0.11dev-r6060 Interactive Trac administration console. Copyright (c) 2003-2007 Edgewall Software
Type: '?' or 'help' for help on commands.
Trac [c:\Python24\Scripts\trac\TracTemplateTime]> upgrade Timing and Estimation needs an upgrade Upgrading Database Upgrading reports Traceback (most recent call last):
File "C:\Python24\Scripts\trac-admin-script.py", line 7, in ?
sys.exit(
File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\admin\console.py", line 1190, in run
admin.run()
File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\admin\console.py", line 119, in run
self.cmdloop()
File "C:\Python24\Lib\cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\admin\console.py", line 102, in onecmd
rv = cmd.Cmd.onecmd(self, line) or 0
File "C:\Python24\Lib\cmd.py", line 219, in onecmd
return func(arg)
File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\admin\console.py", line 1098, in do_upgrade
self.env.upgrade(backup=do_backup)
File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\env.py", line 407, in upgrade
participant.upgrade_environment(db)
File "build\bdist.win32\egg\timingandestimationplugin\api.py", line 258, in upgrade_environment File "build\bdist.win32\egg\timingandestimationplugin\api.py", line 144, in do_reports_upgrade File "build\bdist.win32\egg\timingandestimationplugin\statuses.py", line 13, in get_statuses File "build\bdist.win32\egg\timingandestimationplugin\dbhelper.py", line 102, in get_column_as_list
TypeError: iteration over non-sequence
I've attached the log output.
Any clues?
Attachments (2)
Change History (18)
Changed 17 years ago by
comment:1 Changed 17 years ago by
I was messing with this yesterday, it is possible I broke it... I will fix it and checking a new version soon. Sorry for the inconvenience.
Russ
comment:2 follow-up: 3 Changed 17 years ago by
The error in the log you posted implies to me that you have not gotten permissions correct on the database file (which needs to be read/writable by whatever user your webserver is running as).
The error posted in the description is caused when connecting to the database fails, so I would start checking permissions.
comment:3 Changed 17 years ago by
Ok! I'm running on win2k3 server. I'm running as administrator when upgrading, so that process would have all the needed rights..
I've monitored the file accesses when running the upgrade, mabye you can have a look at it and check if you can see anything wrong?
comment:4 follow-up: 5 Changed 17 years ago by
I cant pick anything out of the Filemon log.
Can you execute the following code in python interactive mode (python.exe -i)? This is a very basic test of whether or not the code is capable of connecting to the database.
from trac.env import Environment from timingandestimationplugin import dbhelper env = Environment('C:\Python24\Scripts\trac\TracTemplateTime') dbhelper.get_all(env.get_db_cnx(), "SELECT * FROM SYSTEM")
it should return something like:
((('name', None, None, None, None, None, None), ('value', None, None, None, None, None, None)), [(u'database_version', u'20'), (u'repository_dir', u'svn:a30255b1-bf40-fd4f-8521-ab2a916d06cd:/var/svn/AAARefrigeration'), (u'TimingAndEstimationPlugin_Db_Version', u'6'), (u'youngest_rev', u'13'), (u'custom_report_manager_version', u'1')])
comment:5 Changed 17 years ago by
This is what i get when executing..
No such file or directory: 'C:
Python24
Scripts\trac
TracTemplateTime
VERSION'
There is'nt one..
C:\Python24>python -i Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from trac.env import Environment >>> from timingandestimationplugin import dbhelper >>> env = Environment('C:\Python24\Scripts\trac\TracTemplateTime') Traceback (most recent call last): File "<stdin>", line 1, in ? File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\env.py", line 177, in __init__ self.verify() File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\env.py", line 231, in verify fd = open(os.path.join(self.path, 'VERSION'), 'r') IOError: [Errno 2] No such file or directory: 'C:\\Python24\\Scripts\trac\\TracTemplateTime\\VERSION' >>>
comment:6 Changed 17 years ago by
Is 'C:
Python24
Scripts\trac
TracTemplateTime' the directory you installed a trac instance to? I had just seen that was where it was connectng its database to and assumed that that was your trac instance.
If this is not working, it seems to me that trac didn't get fully instanced there, or there is some difference between the trac11 you are using and the trac11 I have installed in my test environment.
Someone on another ticket says that the latest version of the plugin is not working on the latest trac11 head revision. I will check out what is going on there then get back to you on this.
comment:7 follow-up: 8 Changed 17 years ago by
This is what my trac instance directory looks like:
README VERSION attachments conf db htdocs log plugins templates wiki-macros
The directory you want to pass to Environment, should have these files and directories in place. Once you can get those dour lines to work in the shell, there is no reason that the plugin should not work.
I also just realized that running the code in the python interactive mode will probably not work without doing a global installation of the plugin. You should still be able to easily remove it by deleting its folder/egg from the C:\Python24\site-packages directory. This should make the code available to all python applications (including python -i mode).
install with: python setup.py install
comment:8 Changed 17 years ago by
I think it's my bad, but I have the VERSION file in TracTemplateTime..
I've removed the egg from C:\Python24\Lib\site-packages. Dowloaded the timingandestimationplugin_branches_trac0.11-r2839.zip file. I've Unzipped and run the
python setup.py install
My dir looks like this:
C:\Python24\Scripts\trac>cd TracTemplate C:\Python24\Scripts\trac\TracTemplate>dir Volume in drive C has no label. Volume Serial Number is F816-9932 Directory of C:\Python24\Scripts\trac\TracTemplate 2007-11-22 09:18 <DIR> . 2007-11-22 09:18 <DIR> .. 2007-11-21 17:23 <DIR> attachments 2007-11-21 17:23 <DIR> conf 2007-11-28 11:49 <DIR> db 2007-11-22 13:43 <DIR> htdocs 2007-11-22 10:29 <DIR> log 2007-11-21 17:23 <DIR> plugins 2007-11-21 17:23 100 README 2007-11-21 17:23 <DIR> templates 2007-11-22 09:22 <DIR> users 2007-11-21 17:23 28 VERSION 2 File(s) 128 bytes 10 Dir(s) 209 170 546 688 bytes free C:\Python24\Scripts\trac\TracTemplate>
And I get the following result (still) when running your script:
C:\Python24>python -i Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from trac.env import Environment >>> from timingandestimationplugin import dbhelper >>> env = Environment('C:\Python24\Scripts\trac\TracTemplateTime') Traceback (most recent call last): File "<stdin>", line 1, in ? File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\env.py", line 177, in __init__ self.verify() File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\env.py", line 231, in verify fd = open(os.path.join(self.path, 'VERSION'), 'r') IOError: [Errno 2] No such file or directory: 'C:\\Python24\\Scripts\trac\\TracTemplateTime\\VERSION' >>>
I've traced the file access with filemon, when I execute the line
env = Environment('C:\Python24\Scripts\trac\TracTemplateTime')
I get this from the trace:
07:27:25 python.exe:2728 OPEN C:\Python24\Scripts NAME INVALID rac\TracTemplateTime\VERSION
btw, thanks a lot for trying to help!!!
comment:9 follow-up: 10 Changed 17 years ago by
looked strange in my last post,
the trace from filemon:
07:27:25 python.exe:2728 OPEN C:\Python24\Scripts NAME INVALID rac\TracTemplateTime\VERSION
comment:10 follow-up: 11 Changed 17 years ago by
I'm new to python, so mabye this isn't a idea that works but could I edit the env.py and add some print statements to check the path vars before it executes open
like:
def verify(self): """Verify that the provided path points to a valid Trac environment directory.""" print self.path print os.path.join(self.path, 'VERSION') fd = open(os.path.join(self.path, 'VERSION'), 'r') try: assert fd.read(26) == 'Trac Environment Version 1' finally: fd.close()
?
comment:11 follow-up: 12 Changed 17 years ago by
I've modified the env.py to try to trace like this:
env.py modification:
def verify(self): """Verify that the provided path points to a valid Trac environment directory.""" print 'self.path=' + self.path print 'os.path.join=' + os.path.join(self.path, 'VERSION') fd = open(os.path.join(self.path, 'VERSION'), 'r') try: assert fd.read(26) == 'Trac Environment Version 1' finally: fd.close()
when I run the env = Environment('C:\Python24\Scripts\trac\TracTemplateTime') command i get:
C:\Python24\Scripts>..\python -i Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from trac.env import Environment >>> from timingandestimationplugin import dbhelper >>> env = Environment('C:\Python24\Scripts\trac\TracTemplateTime') self.path=C:\Python24\Scripts rac\TracTemplateTime os.path.join=C:\Python24\Scripts rac\TracTemplateTime\VERSION Traceback (most recent call last): File "<stdin>", line 1, in ? File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\env.py", line 177, in __init__ self.verify() File "C:\Python24\lib\site-packages\trac-0.11dev_r6060-py2.4.egg\trac\env.py", line 233, in verify fd = open(os.path.join(self.path, 'VERSION'), 'r') IOError: [Errno 2] No such file or directory: 'C:\\Python24\\Scripts\trac\\TracTemplateTime\\VERSION' >>>
comment:12 follow-up: 13 Changed 17 years ago by
ok.. so I've figured out that \t makes a tab in the path..
if I execute
env = Environment('C:\Python24\Scripts\\trac\TracTemplateTime')
then it works... and I can execute the next line:
dbhelper.get_all(env.get_db_cnx(), "SELECT * FROM SYSTEM")
the result is:
((('name', None, None, None, None, None, None), ('value', None, None, None, None, None, None)), [(u'database_version', u '21'), (u'repository_dir', u'svn:d2278ac0-4da6-d94b-9979-00ae6ead6d08:C:/Files/svn-data/svn-root/svh-projects/Framework/ Templates/trac/TracTemplateTime'), (u'youngest_rev', u'5401'), (u'custom_report_manager_version', u'1'), (u'TimingAndEst imationPlugin_Db_Version', u'6')])
mabye the upgrade script also have a problem with \t in the path..
comment:13 Changed 17 years ago by
Problem solved. The evil tab sign made it fail \t.
C:\Python24\Scripts>trac-admin c:\python24\scripts\Trac\TracTemplateTime upgrade self.path=c:\python24\scripts\Trac\TracTemplateTime os.path.join=c:\python24\scripts\Trac\TracTemplateTime\VERSION Timing and Estimation needs an upgrade Upgrading Database Upgrading reports Upgrading fields Upgrading usermanual Done Upgrading Upgrade done.
Thanks a lot for your time, we will bill the guy that came up with backslash for paths in windows! :)
comment:14 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:15 Changed 17 years ago by
hahah Yeah Windows!
Sorry for the confusion, I've done enough windows programming that I probably should have remembered that :(. Either way, good job debugging the python. Glad I could help.
comment:16 Changed 17 years ago by
Thanks man! this helped me too!
I was using as my path:
'e:\rep\trac\SecMan'
so it was generating an error with the \r and the \t
it should be:
os.environTRAC_ENV? = 'e:
rep
trac\SecMan'
Trac log