emc-openstack / storops

Python storage management library for VNX and Unity.
Apache License 2.0
54 stars 29 forks source link

When compiled with pyinstaller cannot find UnityPoolTierList in parser_configs.yaml #301

Closed sirpawelm closed 3 years ago

sirpawelm commented 4 years ago

First of all code below works with python. Problems start after compiling to exe (Windows) . First had issue discussed before: "When compiled with pyinstaller can't read parser_configs.yaml #278" so I changed filename = os.path.join('C:\\Python38\\Lib\\site-packages\\storops\\unity', cls.config_filename) and got rid of that issue but now got another problem:

Code:

import urllib3
from storops import UnitySystem
unity = UnitySystem('192.8.0.10', 'admin', 'Password123!')
urllib3.disable_warnings()
name = unity._get_name()
pools = unity.get_pool()
print(name)
print(unity.info.system_version)
for pool in pools:
    print(pool.size_total / (1024*1024*1024))

Result (first 2 lines of result are correct): UnityA 5.0.0 Traceback (most recent call last): File "unity.py", line 10, in for pool in pools: File "storops-1.2.3-py3.8.egg\storops\lib\resource.py", line 280, in iter File "storops-1.2.3-py3.8.egg\storops\lib\resource.py", line 261, in list File "site-packages\cachez.py", line 206, in func_wrapper File "storops-1.2.3-py3.8.egg\storops\unity\resource__init.py", line 295, in update File "site-packages\cachez.py", line 206, in func_wrapper File "storops-1.2.3-py3.8.egg\storops\lib\resource.py", line 227, in update File "storops-1.2.3-py3.8.egg\storops\unity\resource__init__.py", line 302, in _get_raw_resource File "storops-1.2.3-py3.8.egg\storops\unity\resource\init__.py", line 291, in _get_parser File "site-packages\cachez.py", line 126, in func_wrapper File "site-packages\cachez.py", line 108, in _get_value_from_cache File "storops-1.2.3-py3.8.egg\storops\unity\parser.py", line 45, in get_unity_parser File "storops-1.2.3-py3.8.egg\storops\lib\parser.py", line 337, in get File "storops-1.2.3-py3.8.egg\storops\lib\parser.py", line 348, in _get_property_map File "storops-1.2.3-py3.8.egg\storops\lib\parser.py", line 447, in init_descriptor File "storops-1.2.3-py3.8.egg\storops\lib\parser.py", line 438, in _get_converter File "storops-1.2.3-py3.8.egg\storops\lib\parser.py", line 332, in get File "storops-1.2.3-py3.8.egg\storops\lib\parser.py", line 354, in get_config ValueError: cannot find UnityPoolTierList in parser_configs.yaml. [4936] Failed to execute script unity

sirpawelm commented 4 years ago

I've reinstalled storops to return to old 'storops/lib/metric.py' and 'storops/lib/parser.py' Copied storops directory into my project dir and ran command: pyinstaller.exe -F --add-data 'storops;storops' unity.py

All works.

DingDino commented 4 years ago

@sirpawelm First, it looks like you have solved this problem. Just one question: What do you mean 'old' 'storops/lib/metric.py' and 'storops/lib/parser.py'? Is there anything you changed in these files or you mean a previous version code in storops?

If just something you changed, we can close this issue.