Replies: 1 comment 3 replies
-
This means that the account with which you connected does not have the security permissions to perform the task that you are trying to do. PS: It is kind of hard to read through your question. Next time add some formatting to make it more readable. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My TM1 server is on a Windows server and my python server is on a Linux server and I am executing the tm1py script from my windows laptop. The script using the following code:
def _build_authorization_token_cam(user="user", password="password", namespace="namespace", gateway=None, verify=False):
try:
with TM1Service(
address=address,
port=port,
user=user,
password=password,
namespace=namespace,
#gateway=gateway,
ssl=ssl) as tm1:
server_name = tm1.server.get_server_name()
print("Connection to TM1 established!! your Servername is: {}".format(server_name))
except Exception as e:
print("\nERROR:")
print("\t" + str(e))
AgencyLOB = tm1.power_bi.get_member_properties(
dimension_name="AgencyLOB",
hierarchy_name="AgencyLOB",
skip_consolidations=True)
AgencyLOB
I get a successful connection but is gives the following error:
Connection to TM1 established!! your Servername is: "ServerName"
TM1pyRestException Traceback (most recent call last)
in
353 dimension_name="AgencyLOB",
354 hierarchy_name="AgencyLOB",
--> 355 skip_consolidations=True)
356 AgencyLOB
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Utils/Utils.py in wrapper(self, *args, **kwargs)
59 try:
60 import pandas
---> 61 return func(self, *args, **kwargs)
62 except ImportError:
63 raise ImportError(f"Function '{func.name}' requires pandas")
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Services/PowerBiService.py in get_member_properties(self, dimension_name, hierarchy_name, member_selection, skip_consolidations, attributes, skip_parents, level_names, parent_attribute, skip_weights)
55 dimension_name=dimension_name, hierarchy_name=hierarchy_name, elements=member_selection,
56 skip_consolidations=skip_consolidations, attributes=attributes, skip_parents=skip_parents,
---> 57 level_names=level_names, parent_attribute=parent_attribute, skip_weights=skip_weights)
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Utils/Utils.py in wrapper(self, *args, **kwargs)
59 try:
60 import pandas
---> 61 return func(self, *args, **kwargs)
62 except ImportError:
63 raise ImportError(f"Function '{func.name}' requires pandas")
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Services/ElementService.py in get_elements_dataframe(self, dimension_name, hierarchy_name, elements, skip_consolidations, attributes, attribute_column_prefix, skip_parents, level_names, parent_attribute, skip_weights)
123 raise ValueError("Argument 'element_selection' must be None or str")
124
--> 125 if not self.attribute_cube_exists(dimension_name):
126 raise RuntimeError(self.ELEMENT_ATTRIBUTES_PREFIX + dimension_name + " cube must exist")
127
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Services/ElementService.py in attribute_cube_exists(self, dimension_name, **kwargs)
556 def attribute_cube_exists(self, dimension_name: str, **kwargs) -> bool:
557 url = format_url("/api/v1/Cubes('{}')", self.ELEMENT_ATTRIBUTES_PREFIX + dimension_name)
--> 558 return self._exists(url, **kwargs)
559
560 def _retrieve_mdx_rows_and_cell_values_as_string_set(self, mdx: str, exclude_empty_cells=True, **kwargs):
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Services/ObjectService.py in _exists(self, url, **kwargs)
47 if e.status_code == 404:
48 return False
---> 49 raise e
50
51 @Property
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Services/ObjectService.py in _exists(self, url, **kwargs)
42 """
43 try:
---> 44 self._rest.GET(url, **kwargs)
45 return True
46 except TM1pyRestException as e:
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Services/RestService.py in wrapper(self, url, data, encoding, async_requests_mode, tcp_keepalive, **kwargs)
84
85 # verify
---> 86 self.verify_response(response=response)
87
88 # response encoding
/rsystem/Rapps/Anaconda3_2019/lib/python3.7/site-packages/TM1py/Services/RestService.py in verify_response(response)
491 status_code=response.status_code,
492 reason=response.reason,
--> 493 headers=response.headers)
494
495 @staticmethod
TM1pyRestException: Text: '' - Status Code: 401 - Reason: 'Unauthorized' - Headers: {'Content-Type': 'text/plain', 'Content-Length': '0', 'Connection': 'keep-alive', 'OData-Version': '4.0', 'Set-Cookie': 'TM1SessionId=GD_sUH4S5VbSv73EyIfocU7BLLM; Path=/api/; HttpOnly', 'WWW-Authenticate': 'CAMPassport [http://servername/ibmcognos/bi/v1/disp, CAMNamespace'}
The actual URL is correct and opens and the user is able to logon. Does anyone know what is causing the error?
Beta Was this translation helpful? Give feedback.
All reactions