pastebinit does not work with python3 (modifications suggested)

Bug #665486 reported by François Boulogne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pastebinit
Fix Released
Wishlist
Unassigned

Bug Description

Hi,

I am the archlinux packager for your application. Archlinux switched to python3 some days ago. I patched for archlinux your software in order to use python2 instead python3 (default).

I tried to use python3 and some errors appeared.
I corrected print calls, an exception and urllib usage.

I have again an error with configobj which has been patched on archlinux to be compatible with python3. i ignore for the moment where the error comes from.

Traceback (most recent call last):
  File "/usr/bin/pastebinit3", line 55, in preloadPastebins
    bininstance = configobj.ConfigObj(filename)
  File "/usr/lib/python3.1/site-packages/configobj.py", line 1245, in __init__
    self._load(infile, configspec)
  File "/usr/lib/python3.1/site-packages/configobj.py", line 1311, in _load
    if (not line) or (line[-1] not in ('\r', '\n', '\r\n')):
TypeError: 'int' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pastebinit3", line 261, in <module>
    pastebind = preloadPastebins() #get the config from /etc/pastebin.d/
  File "/usr/bin/pastebinit3", line 56, in preloadPastebins
    except(configobj.ConfigObjError, e):
NameError: global name 'e' is not defined

I will investigate more as soon as I have enough time. For the moment, I can give you a patch with my corrections.
I hope it could help.

Regards.

Revision history for this message
François Boulogne (sciunto.org) wrote :
Revision history for this message
Stéphane Graber (stgraber) wrote :

Hi,

I just ran 2to3 on pastebinit again to check what would need to be updated to get it running on python 3.2.
Sadly the needed changes break compatibility with python < 3.0 so it's not really an option for now.

Once python 3 is shipped by default on most distros, I'll be happy to convert pastebinit and change the interpreter accordingly.

Changed in pastebinit:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Stéphane Graber (stgraber) wrote :

Still no configobj in Debian/Ubuntu so not converting to python3 just yet ... maybe next year.

Revision history for this message
Stefano Rivera (stefanor) wrote :

configobj doesn't support python3 upstream yet

Revision history for this message
Stéphane Graber (stgraber) wrote :

Ported pastebinit to use configparser and made the code work with python2 and python3 (tested with 2.7 and 3.2).

Changed in pastebinit:
status: Triaged → Fix Released
status: Fix Released → Fix Committed
Changed in pastebinit:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.