newsmangler icon indicating copy to clipboard operation
newsmangler copied to clipboard

make compatible with Python2.6 or 3

Open jadedgnome opened this issue 11 years ago • 7 comments

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

jadedgnome avatar Feb 28 '13 16:02 jadedgnome

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))

nickma82 avatar Jul 17 '13 11:07 nickma82

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:

madcowfred avatar Jul 17 '13 11:07 madcowfred

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

nickma82 avatar Jul 17 '13 11:07 nickma82

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

thezoggy avatar Jul 17 '13 13:07 thezoggy

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

nickma82 avatar Jul 17 '13 14:07 nickma82

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

contributors are welcome :)

nickma82 avatar Jul 17 '13 16:07 nickma82

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

nickma82 avatar Jul 23 '13 08:07 nickma82