Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#1710 closed defect (fixed)

problems when trying to upgrade trac

Reported by: anonymous Owned by: Colin Guthrie
Priority: normal Component: WorkLogPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

Work Log needs an upgrade Upgrading Database Creating work_log table Upgrading usermanual Command faild: 'builtin_function_or_method' object has no attribute 'time'

Attachments (0)

Change History (10)

comment:1 Changed 10 years ago by Colin Guthrie

What version of Python are you using?

From what I can gather there is a problem with the time.time() call after import time.

Works fine for me here with Python 2.5.

Can you try this in a file (call it test.py):

import time

print int(time.time())

And run it via cmd line with python test.py.

It should just print out a number (of seconds since Jan 1st 1970) and should not error out.

Thanks

comment:2 Changed 10 years ago by tomek@…

I also have this same error:

Worklog needs an upgrade
Upgrading usermanual
Command failed: 'builtin_function_or_method' object has no attribute 'time'

comment:3 Changed 10 years ago by anonymous

Hi Tomek,

Can you check to see if the test program above in comment 1 works?

Also can you give me info about your Python and Trac versions?

comment:4 Changed 10 years ago by tomek@…

Python 2.4.4 (#2, Apr  5 2007, 20:11:18) 
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> print int(time.time())
1183452962
>>> 

Trac 0.10.3

comment:5 Changed 10 years ago by Colin Guthrie

Thanks for that.

I don't understand why there is an issue :(

The error you get (updating the usermanual) if from a section that uses the the time function exactly like this!

Really odd. Can you edit the line which says when = int(time.time()) in api.py and change it to when = 1183452962 and see if things work then? If so then I'm even more confused!

PS I'm not a particularly great Python coder... this is my first attempt at python code, so still don't really know how the language works - mostly monkey see, monkey do at the moment!

comment:6 Changed 10 years ago by tomek@…

Yup. That did help.

comment:7 Changed 10 years ago by tomek@…

I've changed the when = int(time.time()) to when = int(time()) and it works fine now.

comment:8 Changed 10 years ago by Colin Guthrie

Cool :)

Just a check tho'. If it worked one time, then it wouldn't actually run a second time so your second test may not be conclusive!

Hopefully this works:

from time import time

print int(time())

I'll commit this change to SVN and then it should work.

It's odd that something on the command line that works for you, doesn't work when running trac-admin :(

Anyway, hopefully this is fixed.

comment:9 Changed 10 years ago by Colin Guthrie

Resolution: fixed
Status: newclosed

(In [2367]) Hopefully fixes #1710.

comment:10 Changed 10 years ago by Colin Guthrie

(In [2427]) Reverts r2367. Refs #1710. Revert the time change code I put in as now this breaks it for me on my test system. I do not understand why this is a problem as the exact same code is used in Trac itself (see attachment.py). Please reopen if this remains an issue (note that it may require a clean install)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Colin Guthrie.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.