madcowfred / newsmangler

NNTP binary poster with mulitple connection support
37 stars 18 forks source link

make compatible with Python2.6 or 3 #18

Open jadedgnome opened 11 years ago

jadedgnome commented 11 years ago

My distro doesn't have python 2.7 and i'm missing out on the use of this seemingly easy program.

Regarding 2.6, I have OrderedDict 1.1 installed

Python 2.6 error

File "/home/jadedgnome/bin/newsmangler-master/mangler.py", line 38, in from newsmangler.postmangler import PostMangler File "/home/jadedgnome/bin/newsmangler-master/newsmangler/postmangler.py", line 46, in from newsmangler.article import Article File "/home/jadedgnome/bin/newsmangler-master/newsmangler/article.py", line 28, in from collections import OrderedDict ImportError: cannot import name OrderedDict


python 3.2 error

File "/home/jadedgnome/bin/newsmangler-master/mangler.py", line 93 print 'ERROR: "%s" does not exist or is not a file!' % (arg) ^ SyntaxError: invalid syntax

nickma82 commented 11 years ago

Concerning "python 2.6 error - ImportError: cannot import name OrderedDict" Could you try copying the "Ordered Dict recipe" (recipe-576693-1.py save as OrderedDict.py) to your .../newsmangler/newsmangler/ folder and give feedback? http://code.activestate.com/recipes/576693/

Concerning python 3.x error: print is a method -> every print foo % (bar) statement has to be changed to print(foo % (bar))

madcowfred commented 11 years ago

Added a workaround for Python 2.6.x in 5e6bf8c. Try 'pip install ordereddict' and it should work. If you don't have pip it's generally in some sort of python setuptools package/port/whatever.

Python 3 support is unlikely to happen, though at least it's worth using with 3.3 :octopus:

nickma82 commented 11 years ago

@madcowfred I could contribute changes necessary for 3.x if you'r handling the pull request afterwards? :)

thezoggy commented 11 years ago

would it be more efficient to just have a 3.x trunk ?

nickma82 commented 11 years ago

@thezoggy hmm.. let's see if it's gonna work out like this before :)

nickma82 commented 11 years ago

Started with python 3.x support https://github.com/nickma82/newsmangler/tree/python3_support

contributors are welcome :)

nickma82 commented 11 years ago

python3 support is up... please see: https://github.com/madcowfred/newsmangler/pull/22