pyx12 icon indicating copy to clipboard operation
pyx12 copied to clipboard

Python3 support?

Open juliocvergarah opened this issue 8 years ago • 9 comments

I tried using this module with Python3. Are there any plans to make it compatible with Python3?

juliocvergarah avatar Sep 21 '16 18:09 juliocvergarah

I merged a pull request a few days ago that begins python 3 support. Unit tests are passing under both python 2 and 3. Included scripts are failing.

See https://github.com/azoner/pyx12/tree/py3-fix-scripts

azoner avatar Sep 21 '16 19:09 azoner

I will publish a new release to pypi when python 3 support is complete.

azoner avatar Sep 21 '16 19:09 azoner

Is Python 3 support still in the works, or is it something I would need to take on myself? Thanks!

KennyMonster avatar May 10 '18 18:05 KennyMonster

Maybe related to Python 3 support, but when I tried running the validator against the example file, I got an error:

$ x12valid ~/Projects/pyx12/pyx12/examples/example834_5010.txt 

Traceback (most recent call last):
  File "/home/jbauer/.virtualenvs/salsa/bin/x12valid", line 8, in <module>
    sys.exit(main())
  File "/home/jbauer/.virtualenvs/salsa/lib/python3.7/site-packages/pyx12/scripts/x12valid.py", line 90, in main
    if args.verbose > 0:
TypeError: '>' not supported between instances of 'NoneType' and 'int'

rubic avatar Feb 12 '20 12:02 rubic

I had the same problem - changing the following starting at line 90 in x12valid.py solved it for me:

+ if args.verbose is not None and type(args.verbose).__name__ == 'int':
- if args.verbose > 0:
-     logger.setLevel(logging.DEBUG)
+     if args.verbose > 0:
+         logger.setLevel(logging.DEBUG)

Python 3 has changes regarding to None and ordering comparisons, basically any None types are no longer equivalent to 0. See: Python 3 - What's new - Ordering Comparisons

@azoner @rubic I have created a pull request #69 addressing the reported error. This fix has resolved it for me. Let me know if any questions.

ddw360 avatar Feb 12 '20 15:02 ddw360

Is this still open? Giving a first pass on this but don't see much documentation. I made the change mentioned by @ddw360 but getting a different error. Would love to contribute to this project.

eddyizm avatar Aug 11 '20 22:08 eddyizm

The py3-port branch includes my PR #54 that fixed a bunch of compatibility issues. I've been using that branch on python 3.6 and 3.7 with no issues. It would be good to ship that to pypi, but it's usable as-is: https://github.com/azoner/pyx12/tree/py3-port

lucaswiman avatar Oct 17 '20 00:10 lucaswiman

@lucaswiman is there a way to do pip install for this python 3? Or do you copy over the source code and use it with python 3?

menacher avatar Dec 04 '20 22:12 menacher

@menacher https://adamj.eu/tech/2019/03/11/pip-install-from-a-git-repository/

lucaswiman avatar Dec 05 '20 00:12 lucaswiman