Skip to content

Python syntax in terminal with multiple python versions and os not working as expected #2

@PS101010

Description

@PS101010

Hello,

I tried using the example from the doc(techrep-2018.pdf) in the terminal.
I followed all obvious steps

  • installed graphviz,
  • installed fastidious,
  • cloned zinc.git from github and extracted it,
  • and added "." to path.

I used several python versions (3.5-3.9, with and without anaconda) on a virtual machine (easier & quicker to do this) and on a raspberry to exclude errors due to my specific build .
They all failed due to the same error codes (corresponding to python version,- independent of os).

I got the following copied terminal in/output:

Python 3.5

(py354) a@a:~$ pwd 
/home/a
(py354) a@a:~$ cd zinc
(py354) a@a:~/zinc$ python --version
Python 3.5.4 :: Anaconda, Inc.
(py354) a@a:~/zinc$ pip show fastidious
Name: fastidious
Version: 0.1.dev0
Summary: Yet another python parser generator
Home-page: https://github.com/lisael/fastidious
Author: lisael
Author-email: lisael@lisael.org
License: GPLv3
Location: /home/a/anaconda3/envs/py354/lib/python3.5/site-packages
Requires: 
(py354) a@a:~/zinc$ echo $PATH
/home/a/anaconda3/envs/py354/bin:/home/a/anaconda3/condabin:/home/a:/.local/bin:/usr/local
/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:.:/usr/games:/snap/bin
(py354) a@a:~/zinc$ python
Python 3.5.4 |Anaconda, Inc.| (default, Nov 20 2017, 18:44:38) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from zinc.nets import *
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/a/zinc/zinc/nets.py", line 5, in <module>
  from .nodes import Node, Place, Transition
  File "/home/a/zinc/zinc/nodes.py", line 5, in <module>
  from .tokens import Token
  File "/home/a/zinc/zinc/tokens.py", line 39, in <module>
  class BlackToken (Token, enum.IntEnum) :
  File "/home/a/zinc/zinc/tokens.py", line 40, in BlackToken
  DOT = enum.auto()
 AttributeError: module 'enum' has no attribute 'auto'

Python 3.6

(py361-0) a@a:~/zinc$ pwd
/home/a/zinc
(py361-0) a@a:~/zinc$ python
Python 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from zinc.nets import *
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/a/zinc/zinc/nets.py", line 5, in <module>
 from .nodes import Node, Place, Transition
 File "/home/a/zinc/zinc/nodes.py", line 5, in <module>
 from .tokens import Token
 File "/home/a/zinc/zinc/tokens.py", line 39, in <module>
  class BlackToken (Token, enum.IntEnum) :
 File "/home/a/anaconda3/envs/py361-0/lib/python3.6/enum.py", line 197, in __new__
 enum_member = __new__(enum_class)
TypeError: object.__new__(BlackToken) is not safe, use int.__new__()

Python 3.7++-(3.9.0a6)

(py377) a@a:~/zinc$ python -V
Python 3.7.7
(py377) a@a:~/zinc$ pwd
/home/a/zinc
(py377) a@a:~/zinc$ echo $PATH
 /home/a/anaconda3/envs/py377/bin:/home/a/anaconda3/condabin:/home/a:/.local/bin:/usr/local
 /sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:.:/usr/games:/snap/bin
(py377) a@a:~/zinc$ pip show fastidious
Name: fastidious
Version: 0.1.dev0
Summary: Yet another python parser generator
Home-page: https://github.com/lisael/fastidious
Author: lisael
Author-email: lisael@lisael.org
License: GPLv3
Location: /home/a/anaconda3/envs/py377/lib/python3.7/site-packages
Requires: 
Required-by: 
(py377) a@a:~/zinc$ python
Python 3.7.7 (default, Mar 26 2020, 15:48:22) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from zinc.nets import *
>>> 
>>> net = PetriNet("Erathostene␣sieve", lang="python")
>>> 
>>> net.add_place(Place("p", ["2", "3", "4", "5", "6"], "int"))
WARNING:root:interpreted Python token '2' in p as source code "'2'"
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/a/zinc/zinc/nodes.py", line 26, in __init__
  t = Token(repr(t))
 TypeError: Token() takes no arguments

After some searching I concluded that for the current module the requirement should be set to python 3.7++.
I haven't found any clue what I did wrong or why I get an errorcode for python 3.7.
Did I do something fundementally wrong in above steps or did the input syntax change?

After my research I think, that

  • python 3.5 can't work due to the missing "auto"-helper inplementation
  • in python 3.6 this happens as far as I understand it due to following change

I'd appreciate a very brief answer and in case of a changed syntax a short example.
In case of no obvious error I'd appreciate a short post about a working build with zinc

Thanks in advance for answering

P.S. If needed i can post logs with all installed packages instread of above abbreviated form

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions