xflr6/graphviz

`py-graphiz` error: `AttributeError: module 'platform' has no attribute 'system'`

Closed this issue · 2 comments

Trying to run tests for a package which depends on py-graphviz via py-objgraph fails:

36-202% /opt/local/bin/python3.11 -m unittest discover
E
======================================================================
ERROR: tests (unittest.loader._FailedTest.tests)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/loader.py", line 452, in _find_test_path
    package = self._get_module_from_name(name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/loader.py", line 362, in _get_module_from_name
    __import__(name)
  File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-greenlet/py311-greenlet/work/greenlet-8cb3791357b42b31d48cc0030ba68d73e0ee3b09/src/greenlet/tests/__init__.py", line 24, in <module>
    from . import leakcheck
  File "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_python_py-greenlet/py311-greenlet/work/greenlet-8cb3791357b42b31d48cc0030ba68d73e0ee3b09/src/greenlet/tests/leakcheck.py", line 34, in <module>
    import objgraph
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/objgraph.py", line 51, in <module>
    import graphviz
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/graphviz/__init__.py", line 31, in <module>
    from .backend import (DOT_BINARY, UNFLATTEN_BINARY,
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/graphviz/backend/__init__.py", line 3, in <module>
    from .dot_command import DOT_BINARY
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/graphviz/backend/dot_command.py", line 7, in <module>
    from .. import exceptions
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/graphviz/exceptions.py", line 3, in <module>
    from .backend.execute import ExecutableNotFound, CalledProcessError
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/graphviz/backend/execute.py", line 10, in <module>
    from .. import _compat
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/graphviz/_compat.py", line 25, in <module>
    if platform.system() == 'Windows':  # pragma: no cover
       ^^^^^^^^^^^^^^^
AttributeError: module 'platform' has no attribute 'system'
xflr6 commented

From AttributeError: module 'platform' has no attribute 'system' (documentation) and skimming the context in python-greenlet/greenlet#419, I suspect the problem is that in your environment you have imported a file named platform.py that conflicts with the one from the Python stdlib, see python-greenlet/greenlet#419 (comment).

Note that this library is tested under macos-latest (see build.yaml), so I am closing this as not reproducible.

@xflr6 Yes, sorry for a false alarm, it is apparently a conflict issue.