adamcharnock / mate3

Python library & CLI for your Outback/Mate3s solar power system
MIT License
10 stars 8 forks source link

can not get cli to run #35

Open rtveng opened 3 years ago

rtveng commented 3 years ago

Thank you for this work. I am very excited to use it. I attempting to connect to a mate3s.

C:\Users\parker>mate3 devices -host 10.220.10.44
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\parker\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\mate3.exe\__main__.py", line 4, in <module>
  File "C:\Users\parker\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mate3\main.py", line 13, in <module>
    from mate3.api import Mate3Client
  File "C:\Users\parker\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mate3\api.py", line 8, in <module>
    from mate3.devices import DeviceValues
  File "C:\Users\parker\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mate3\devices.py", line 10, in <module>
    from mate3.sunspec.models import (
  File "C:\Users\parker\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mate3\sunspec\models.py", line 22, in <module>
    class CCconfigFaultsFlags(BitfieldDescriptionMixin, IntFlag):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\enum.py", line 131, in __prepare__
    member_type, first_enum = metacls._get_mixins_(cls, bases)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\enum.py", line 523, in _get_mixins_
    member_type = _find_data_type(bases) or object
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\enum.py", line 511, in _find_data_type
    raise TypeError('%r: too many data types: %r' % (class_name, data_types))
TypeError: 'CCconfigFaultsFlags': too many data types: [<class 'mate3.sunspec.fields.BitfieldDescriptionMixin'>, <class 'int'>]
kodonnell commented 3 years ago

Thanks for trying it out @rtveng ! I'm pretty sure this is something that happens in Python 3.8/3.9 - can you try on Python 3.7?

matteing commented 3 years ago

Also experiencing this issue.

maddiebeaton commented 3 years ago

I can confirm it works on Python 3.7 but I get the same error on Python 3.8

rrooggiieerr commented 2 years ago

I've got the same problem.

Update 24 Jan 2022: Seems that pip install mate3 installs an old version of the mate3 package which doesn't include the Python 3.8/3.9 fixes

pip show mate3 output:

Name: mate3
Version: 0.6.2
Summary: Outback Mate3s Python Library
Home-page: https://github.com/adamcharnock/mate3/
Author: Adam Charnock
Author-email: adam@adamcharnock.com
License: 
Location: /Users/rogier/Library/Python/3.9/lib/python/site-packages
Requires: fixedint, loguru, pymodbus
Required-by:
BrettLHolmes commented 1 year ago

Hi All

I see this Code was done some time ago and I was trying to run it on a Python 3.11 (on a Mac) and get the same issue as for version 3.8 and version 3.9 and before I start digging into this further wanted to see if any work was being done else where to resolve this or any advice for me. If this change here does resolve the pythod version issue then I need to figure out how to install it over the standard pip install mate3

PS

pip show mate3
Name: mate3
Version: 0.6.2
Summary: Outback Mate3s Python Library
Home-page: https://github.com/adamcharnock/mate3/
Author: Adam Charnock
Author-email: adam@adamcharnock.com
License:
Location: /opt/homebrew/lib/python3.11/site-packages
Requires: fixedint, loguru, pymodbus
Required-by:

the error

mate3
Traceback (most recent call last):
  File "/opt/homebrew/bin/mate3", line 5, in <module>
    from mate3.main import main
  File "/opt/homebrew/lib/python3.11/site-packages/mate3/main.py", line 13, in <module>
    from mate3.api import Mate3Client
  File "/opt/homebrew/lib/python3.11/site-packages/mate3/api.py", line 8, in <module>
    from mate3.devices import DeviceValues
  File "/opt/homebrew/lib/python3.11/site-packages/mate3/devices.py", line 10, in <module>
    from mate3.sunspec.models import (
  File "/opt/homebrew/lib/python3.11/site-packages/mate3/sunspec/models.py", line 22, in <module>
    class CCconfigFaultsFlags(BitfieldDescriptionMixin, IntFlag):
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py", line 489, in __prepare__
    member_type, first_enum = metacls._get_mixins_(cls, bases)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py", line 958, in _get_mixins_
    member_type = mcls._find_data_type_(class_name, bases) or object
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py", line 998, in _find_data_type_
    raise TypeError('too many data types for %r: %r' % (class_name, data_types))
TypeError: too many data types for 'CCconfigFaultsFlags': {<class 'mate3.sunspec.fields.BitfieldDescriptionMixin'>, <class 'int'>}
eshattow commented 2 weeks ago

What's the fix for this?