irods / python-irodsclient

A Python API for iRODS
Other
62 stars 73 forks source link

python-irodsclient failing on python3.7 #179

Closed mohamadhayek closed 4 years ago

mohamadhayek commented 4 years ago

Hello

I've been working for some time with the irods python clients on python3.5 without major issues. When switching to python3.7, I am running into an error when running the following code: `from irods.session import iRODSSession

with iRODSSession(host='ip', port=1247, user='rods', password='testpassword', zone='tempZone') as session: coll = session.collections.get("/tempZone/home/rods") print(coll.id)`

I am getting the following error: Traceback (most recent call last): File "test2.py", line 1, in from irods.session import iRODSSession File "/home/user/.local/lib/python3.7/site-packages/irods/session.py", line 1, in from irods.query import Query File "/home/user/.local/lib/python3.7/site-packages/irods/query.py", line 5, in from irods.message import ( File "/home/user/.local/lib/python3.7/site-packages/irods/message/init.py", line 7, in from irods.message.message import Message File "/home/user/.local/lib/python3.7/site-packages/irods/message/message.py", line 5, in from irods.message.ordered import OrderedProperty, OrderedMetaclass, OrderedClass File "/home/user/.local/lib/python3.7/site-packages/irods/message/ordered.py", line 23 key = lambda (name, property): property._creation_counter, ^ SyntaxError: invalid syntax

d-w-moore commented 4 years ago

hi Mohamad,

The error seems unrelated to the example code you've given. Is your iRODSSession example usage, as well as the code in test2.py from which the error seems to be originating, all contained in test2.py ? If not, make sure that side effects of an import statement or of the PYTHONSTARTUP environment variable are not causing unintended code fragments to be loaded and executed.

Also keep in mind that Python3 is pickier regarding the mixing of space and tab characters in indentation, and these may be causing spurious (and potentially undeserved) complaints from the interpreter about your syntax.

Otherwise, the Python iRODS Client should work fine with versions 3.7.* of Python. If you have docker available on your system, you can verify this is true in an isolated environment:

$ docker run --add-host=: -it --rm python:3 bash root@6e25c166a3ed:/# pip install python-irodsclient Collecting python-irodsclient Downloading https://files.pythonhosted.org/packages/80/02/5abc8dba9c1654e3a53ac9cda288c5d580bbdcf5cd62e1493314e75661b4/python_irodsclient-0.8.2-py2.py3-none-any.whl (97kB) (...) root@6e25c166a3ed:/# python Python 3.7.2 (default, Mar 5 2019, 06:22:51) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information.

from irods.session import iRODSSession session = iRODSSession(host='MY_IRODS_HOST', port=1247, user='rods', password='MY_PASSWORD', zone='tempZone') coll = session.collections.get('/tempZone/home/rods') coll <iRODSCollection 10011 b'rods'> coll.id 10011

Similarly, if you have virtualenv on your system, you can test in a semi-isolated environment from within a normal Bash shell: $ virtualenv -p python3 myenv3 $ source myenv3/bin/activate $ pip3 install python-irodsclient $ python3

from irods.session import iRODSSession ... (run your tests here)

Daniel Moore Applications Engineer iRODS Consortium, RENCI, UNC Chapel Hill (919) 445-9616


From: mohamadhayek notifications@github.com Sent: Tuesday, November 19, 2019 4:37 AM To: irods/python-irodsclient python-irodsclient@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [irods/python-irodsclient] python-irodsclient failing on python3.7 (#179)

Hello

I've been working for some time with the irods python clients on python3.5 without major issues. When switching to python3.7, I am running into an error when running the following code: `from irods.session import iRODSSession

with iRODSSession(host='ip', port=1247, user='rods', password='testpassword', zone='tempZone') as session: coll = session.collections.get("/tempZone/home/rods") print(coll.id)`

I am getting the following error: Traceback (most recent call last): File "test2.py", line 1, in from irods.session import iRODSSession File "/home/di39quq/.local/lib/python3.7/site-packages/irods/session.py", line 1, in from irods.query import Query File "/home/di39quq/.local/lib/python3.7/site-packages/irods/query.py", line 5, in from irods.message import ( File "/home/di39quq/.local/lib/python3.7/site-packages/irods/message/init.py", line 7, in from irods.message.message import Message File "/home/di39quq/.local/lib/python3.7/site-packages/irods/message/message.py", line 5, in from irods.message.ordered import OrderedProperty, OrderedMetaclass, OrderedClass File "/home/di39quq/.local/lib/python3.7/site-packages/irods/message/ordered.py", line 23 key = lambda (name, property): property._creation_counter, ^ SyntaxError: invalid syntax

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/irods/python-irodsclient/issues/179?email_source=notifications&email_token=AIM2TBIOA7V22FZV6TT5GALQUOXUTA5CNFSM4JPAO33KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H2JEF3A, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIM2TBKZVFFK3LPK7MM6Q3LQUOXUTANCNFSM4JPAO33A.