#11375 closed defect (worksforme)
Upgrade error
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | |
Component: | general | Version: | |
Severity: | normal | Keywords: | needinfo db26 |
Cc: | Ryan J Ollos | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
trac-admin /var/lib/trac/myProject upgrade The upgrade failed. Please fix the issue and try again.
ValueError: invalid literal for int() with base 10:
Attachments (0)
Change History (14)
comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
Hello
The version is 0.10.4 Plugins installed timingandestimationplugin 0.7.4
I updated others projects into trac, only one have this issue. when i use this project trac with other database (of another project) its work well. May be an schema or data problem?
Thanks!
comment:3 by , 11 years ago
Could you please turn on logging and post a traceback?
What led to the error? Are you attempting to upgrade Trac, or did you just install the plugin?
I wonder if you have inadvertently upgraded the trac database for this instance. Is it running SQLite?
comment:4 by , 11 years ago
Keywords: | needinfo added |
---|
comment:5 by , 11 years ago
Hi,
How i can turn on logging? I upgraded Trac (with 30 projects) and only one project had this issue. I use postgres database for all Trac projects.
Thanks
comment:7 by , 11 years ago
Hi,
Traceback:
2013-12-05 09:39:29,340 Trac[loader] ERROR: Skipping "timingandestimationplugin = timingandestimationplugin": Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/loader.py", line 68, in _load_eggs entry.load(require=True) File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2108, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "/usr/local/lib/python2.7/dist-packages/timingandestimationplugin-0.7.4-py2.7.egg/timingandestimationplugin/__init__.py", line 1, in <module> from api import * File "/usr/local/lib/python2.7/dist-packages/timingandestimationplugin-0.7.4-py2.7.egg/timingandestimationplugin/api.py", line 6, in <module> from trac.log import logger_factory ImportError: cannot import name logger_factory 2013-12-05 09:39:29,538 Trac[loader] ERROR: Failed to load plugin from /var/lib/trac/Nemogroup-Ola/plugins/bugzilla.py: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/loader.py", line 90, in _load_py_files module = imp.load_source(plugin_name, plugin_file) File "/var/lib/trac/Nemogroup-Ola/plugins/bugzilla.py", line 23 yield (":*[Bb]ug #?(?P<ticketid>\d+)", lambda x, y, z: self._format_symbol(z.group("ticketid"))) ^ IndentationError: expected an indented block (bugzilla.py, line 23) 2013-12-05 09:39:33,076 Trac[console] ERROR: Exception in trac-admin command: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/admin/console.py", line 109, in onecmd rv = cmd.Cmd.onecmd(self, line) or 0 File "/usr/lib/python2.7/cmd.py", line 220, in onecmd return self.default(line) File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/admin/console.py", line 285, in default return cmd_mgr.execute_command(*args) File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/admin/api.py", line 124, in execute_command return f(*fargs) File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/env.py", line 975, in _do_upgrade self.env.upgrade(backup=no_backup is None) File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/env.py", line 709, in upgrade participant.upgrade_environment(db) File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/env.py", line 773, in upgrade_environment script.do_upgrade(self.env, i, cursor) File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.2dev_r12259-py2.7.egg/trac/upgrades/db26.py", line 26, in do_upgrade """, ('%010d' % int(rev), id, rev)) ValueError: invalid literal for int() with base 10: ''
comment:8 by , 11 years ago
Regarding the first two errors:
- It looks like you are running the 0.10 branch of th:TimingAndEstimationPlugin, so you'll need to upgrade that plugin if you wish to continue using it.
- There is an indentation problem in your plugin file:
bugzilla.py
.
Finally, the upgrade is failing here. I guess we need to figure out why there is an entry in your revision
table that is an empty string (see TracDev/DatabaseSchema/VersionControl#Tablerevision for reference).
Which database are you running? Maybe we can run some queries to inspect the database. Another option would be to make a patch for db26.py
that skips rows with an empty revision
and print those rows as debug info.
comment:9 by , 11 years ago
Hi!!
You was right! i found one entry in revision table with an empty string. I fix that and the upgrate works fine.
Thanks a lot from Argentina!
comment:10 by , 11 years ago
I'm glad it's fixed for you. Any idea how that entry ended up in the table?
follow-up: 13 comment:11 by , 11 years ago
Was the first entry in the revision table, it had empty value on rev column.
comment:12 by , 11 years ago
Keywords: | db26 added |
---|
comment:13 by , 11 years ago
Replying to anonymous:
Was the first entry in the revision table, it had empty value on rev column.
Are there any revisions missing from the linear revision history? First thing to check would be whether revision 1 might be missing.
comment:14 by , 11 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I tried the following:
- Created an instance of Trac 0.11.
- Added a few revisions to a subversion repository.
- Replaced
1
in therev
column of row 1 with an empty string.
Now there's a traceback when navigating to log
:
File "/home/user/Workspace/t11375/trac-0.11.3/trac/versioncontrol/templates/revisionlog.html", line 142, in <Expression u'dateinfo(change.date)'> <td class="date" py:content="dateinfo(change.date)" /> File "/home/user/Workspace/t11375/trac-0.11.3/trac/timeline/web_ui.py", line 236, in dateinfo pretty_timedelta(date), File "/home/user/Workspace/t11375/trac-0.11.3/trac/util/datefmt.py", line 71, in pretty_timedelta time1 = to_datetime(time1) File "/home/user/Workspace/t11375/trac-0.11.3/trac/util/datefmt.py", line 51, in to_datetime type(t))
In the revision
table, rev
is the primary key, so I guess that only one column can be an empty string.
Not surprisingly, I saw the same issue as you. If we see this again, we could add some additional checks to db26.py
.
I am wondering though, if we should print the traceback to the console when we encounter an issue like this. That way, rather than,
$ trac-admin tracdev upgrade The upgrade failed. Please fix the issue and try again. ValueError: invalid literal for int() with base 10: ''
we get,
$ trac-admin tracdev upgrade The upgrade failed. Please fix the issue and try again. Traceback (most recent call last): File "/home/user/Workspace/t11375/teo-rjollos.git/trac/env.py", line 975, in _do_upgrade self.env.upgrade(backup=no_backup is None) File "/home/user/Workspace/t11375/teo-rjollos.git/trac/env.py", line 709, in upgrade participant.upgrade_environment(db) File "/home/user/Workspace/t11375/teo-rjollos.git/trac/env.py", line 773, in upgrade_environment script.do_upgrade(self.env, i, cursor) File "/home/user/Workspace/t11375/teo-rjollos.git/trac/upgrades/db26.py", line 27, in do_upgrade """, ('%010d' % int(rev), id, rev)) ValueError: invalid literal for int() with base 10: ''
-
trac/env.py
diff --git a/trac/env.py b/trac/env.py index 567d32c..06fcd0f 100644
a b class EnvironmentAdmin(Component): 979 979 raise e.args[0] 980 980 except Exception, e: 981 981 printerr(_("The upgrade failed. Please fix the issue and try " 982 "again.\n")) 983 raise 982 "again.\n%(exc)s", 983 exc=exception_to_unicode(e, traceback=True))) 984 return 984 985 985 986 # Remove wiki-macros if it is empty and warn if it isn't 986 987 wiki_macros = os.path.join(self.env.path, 'wiki-macros')
Which version of Trac are you running? Do you have any plugins installed, and did you install a plugin immediately before encountering this error? This could be a PluginIssue.