Ticket #197 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

PacketManipulator doesn't run on Python 2.4

Reported by: getxsick Owned by: nopper
Priority: high Milestone: Umit 1.0beta1
Component: PacketManipulator Version: current svn
Keywords: Cc:

Description

and it should :)

Attachments

python-24-backport.diff (22.3 kB) - added by nopper 4 years ago.
python-24-backport-2.diff (22.1 kB) - added by nopper 4 years ago.
python-24-backport-3.diff (22.2 kB) - added by nopper 4 years ago.

Change History

Changed 4 years ago by nopper

  • status changed from new to closed
  • resolution set to invalid

I use sax in Preference Manager and with python 2.4 I cannot run PM because of this bug fixed only in latest 2.5 releases http://mail.python.org/pipermail/python-bugs-list/2006-March/032563.html

Changed 4 years ago by gpolo

Why did you set the resolution to invalid ? At max it could be a "won't fix".

Also, looking in that code, I've found no namespace usage except by the sax namespace api being used.

Changed 4 years ago by nopper

I can't understand this kind of ironism. What do you intend with "I've found no namaspace usage" ..

I'm using the XMLGenerator of sax but I get this traceback. If someone could help me without being messy is welcome.

Traceback (most recent call last):
  File "PM/PacketManipulator", line 139, in ?
    main(sys.argv)
  File "PM/PacketManipulator", line 128, in main
    app = PMApp()
  File "/home/stack/PacketManipulator/PM/Gui/Core/App.py", line 70, in __init__
    from MainWindow import MainWindow
  File "/home/stack/PacketManipulator/PM/Gui/Core/MainWindow.py", line 28, in ?
    from PM import Backend
  File "/home/stack/PacketManipulator/PM/Backend/__init__.py", line 34, in ?
    from Abstract.BaseContext.Static import StaticContext
  File "/home/stack/PacketManipulator/PM/Backend/Abstract/BaseContext/Static.py", line 22, in ?
    from PM.Backend.Abstract.Context import register_static_context
  File "/home/stack/PacketManipulator/PM/Backend/Abstract/Context/__init__.py", line 84, in ?
    if Prefs()['backend.system'].value.lower() == 'umpa':
  File "/home/stack/PacketManipulator/PM/Manager/PreferenceManager.py", line 233, in __init__
    self.write_options()
  File "/home/stack/PacketManipulator/PM/Manager/PreferenceManager.py", line 244, in write_options
    writer = PreferenceWriter(self.fname, self.options)
  File "/home/stack/PacketManipulator/PM/Manager/PreferenceManager.py", line 175, in __init__
    str(option.type), attrs)
  File "/home/stack/PacketManipulator/PM/Manager/PreferenceManager.py", line 140, in startElement
    self.writer.startElementNS(names, qnames, attrs)
  File "xml/sax/saxutils.py", line 141, in startElementNS
KeyError

Changed 4 years ago by gpolo

I wasn't being ironic, really. Where are you using namespaces ? I have found none.

And you are mixing the namespace aware api with the non-namespace api in PreferenceManager?.

Changed 4 years ago by getxsick

  • status changed from closed to reopened
  • resolution invalid deleted

I'm reopening this ticket because of some discussion are still open.

Changed 4 years ago by nopper

I've written this patch but seems too dirty for the with statement missing in py24. Anyone could test it?

Changed 4 years ago by nopper

Changed 4 years ago by gpolo

Besides everything I have already said about the patch on #umit, there are some final comments I would like to tell about this defaultdict fallback (I would have said there too, but you left).

* I would like to see the try/except in getitem being replaced by an if/else; * Replacing items by iteritems in reduce would be nice too.

Changed 4 years ago by nopper

Changed 4 years ago by nopper

Changed 4 years ago by nopper

Check out the python-24-backport-3.diff patch

Changed 4 years ago by gpolo

This is good, just a last note on it:

* You made a O(1) operation an O(n) operation when you changed the fallback defaultdict.__getitem__ like that, please use a simple containment test: if key in self

Also, in PM/Gui/Plugins/Tree.py you have a except Exception, exc but exc is never used, consider removing it. This code was already there, so when you change this make sure this is on a different commit.

Finally, as I remember the backend wasn't done by you but it also needs some fixing regarding the usage of the namespace sax api. The ticket is named as "PacketManipulator doesn't run on Python 2.4" so the backend also needs to be fixed.

So, for now, adjust defaultdict.__getitem__ and commit it in the PacketManipulator branch and then merge it into trunk, or if you prefer I can merge it. Leave the ticket open for now, since some parts of PacketManipulator still need fixing.

Changed 4 years ago by nopper

  • status changed from reopened to closed
  • resolution set to fixed

Ok should work now. If you have any trouble don't esitate to reopen the ticket.

Note: See TracTickets for help on using tickets.