Modify

Opened 17 years ago

Closed 17 years ago

Last modified 15 years ago

#1736 closed defect (fixed)

getting it to work under Python 2.5

Reported by: rdeman Owned by: Christophe de Vienne
Priority: high Component: PageToOdtPlugin
Severity: blocker Keywords: python 2.5
Cc: Trac Release: 0.10

Description

First my plugin did not work at all (it did not show uo in WebAdmin -> Plugins) Then I figured that b/c I am using Python 2.5 I need to change the import statement si replaced in pagetoodt.py

#import cElementTree as ElementTree

with

from xml.etree.ElementTree import Element, ElementTree # python 2.5

note that I am a total Python newbie... at least the plugin shows up in the WebAdmin -> Plugins menu now and it is activated... .but now I have the same problem as described above.

But now I get this error:

Python Traceback

Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/trac/web/main.py", line 387, in dispatch_request
    dispatcher.dispatch(req)
  File "/var/lib/python-support/python2.5/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/var/lib/python-support/python2.5/trac/wiki/web_ui.py", line 134, in process_request
    page.text, format, page.name)
  File "/var/lib/python-support/python2.5/trac/mimeview/api.py", line 604, in send_converted
    content, selector)
  File "/var/lib/python-support/python2.5/trac/mimeview/api.py", line 384, in convert_content
    output = converter.convert_content(req, mimetype, content, ck)
  File "build/bdist.linux-i686/egg/pagetoodt/pagetoodt.py", line 30, in convert_content
    archive = zipfile.ZipFile(self.template_filename, 'r')
  File "zipfile.py", line 339, in __init__
    self.fp = open(file, modeDict[mode])
IOError: [Errno 2] No such file or directory: u'/var/www/trac/pwc/attachments/wiki/PageToOdtStyles/empty.odt'

Attachments (0)

Change History (5)

comment:1 Changed 17 years ago by rdeman

Resolution: fixed
Status: newclosed

here is the fix (tested and verified) to get the plugin working with Python 2.5

replace in pagetoodt.py

import cElementTree as ElementTree

with

try:
	# python 2.5 way of life :)
	import xml.etree.cElementTree as ElementTree
except:
	# python 2.4
	import cElementTree as ElementTree 

Don't forget to

now it should work

comment:2 Changed 17 years ago by Jason Winnebeck

Resolution: fixed
Status: closedreopened

This didn't actually appear to be checked in?

comment:3 Changed 17 years ago by Christophe de Vienne

Resolution: fixed
Status: reopenedclosed

Applied in r2650.

Thanks for the patch and sorry for the delay.

comment:4 Changed 17 years ago by anonymous

If this makes the plugin stable and work on 0.11, let's add the 0.11 tag to the plugin page to advertise 0.11 support.

comment:5 Changed 17 years ago by Jason Winnebeck

Wow, wrong ticket, sorry I was really off in another world on that one. This ticket is adding Python 2.5 support.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christophe de Vienne.
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.