在 TM1 和 Python 方面,我完全是新手,在尝试使用 TM1py 包连接和提取一些数据时遇到以下错误。错误:
Traceback (most recent call last):
File "D:\TM3.py", line 4, in <module>
TM1Service(address="11.22.33.123", Servers="serverName", port=85, user='activeuser', password='correctpassword', ssl=True)
File "D:\Program Files (x86)\Python39-32\lib\site-packages\TM1py\Services\TM1Service.py", line 15, in __init__
self._tm1_rest = RestService(**kwargs)
File "D:\Program Files (x86)\Python39-32\lib\site-packages\TM1py\Services\RestService.py", line 200, in __init__
self._start_session(
File "D:\Program Files (x86)\Python39-32\lib\site-packages\TM1py\Services\RestService.py", line 368, in _start_session
self._version = response.text
AttributeError: 'NoneType' object has no attribute 'text'
编码:
from TM1py.Services import TM1Service
from TM1py.Utils.Utils import build_pandas_dataframe_from_cellset
with TM1Service(address="11.22.33.123", Servers="serverName", port=85, user='activeuser', password='correctpassword', ssl=True) as tm1:
data =tm1.cubes.cells.execute_view(cube_name="CubeName", view_name="ViewName", private=True)
df=build_pandas_dataframe_from_cellset(data,multiindex=False)
tm1.logout()
df.to_csv(r'D:\data.csv', index = False, header=True)
完全相同的代码在不同的 VM 上完美运行并提取数据。我已经将新 VM 设置为镜像(相同版本的 Python、所有软件包 - pip 列表、相同的代理设置、从新 VM 到 TM1 的网络访问测试和工作等)。
不知何故,在新设置的 VM 上,在 CMD/Task 中运行 Py 脚本时出现此错误。我到处搜索,找不到原因或解决方法。高度赞赏所有帮助!