Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

com_error: (-2147221005, 'Invalid class string', None, None) when connecting to Ansys Desktop #81

Open
xiasitan opened this issue Jul 8, 2021 · 2 comments

Comments

@xiasitan
Copy link

xiasitan commented Jul 8, 2021

I just tried to set up pyEPR with Ansys on a new PC. Created a new environment and installed all required packages. Now, when I try to connect to Ansys with epr.ProjectInfo,
pinfo = epr.ProjectInfo(project_path = os.getcwd(),
project_name = 'TripleCats',)

it connects to Ansys and finds the correct file path, but then spits out this error

com_error                                 Traceback (most recent call last)
~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
     88                 try:
---> 89                         IDispatch = pythoncom.connect(IDispatch)
     90                 except pythoncom.ole_error:

com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

com_error                                 Traceback (most recent call last)
<ipython-input-3-f7191f53f00d> in <module>
----> 1 pinfo = epr.ProjectInfo(project_path = os.getcwd(), 
      2                          project_name = 'TripleCats',)

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\project_info.py in __init__(self, project_path, project_name, design_name, setup_name, do_connect)
    209 
    210         if do_connect:
--> 211             self.connect()
    212             self.dissipative['pinfo'] = self
    213 

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\project_info.py in connect(self)
    343         """
    344 
--> 345         self.connect_project()
    346         if not self.project:
    347             logger.info('\tConnection to Ansys NOT established.  \n')

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\project_info.py in connect_project(self)
    239         logger.info('Connecting to Ansys Desktop API...')
    240 
--> 241         self.app, self.desktop, self.project = ansys.load_ansys_project(
    242             self.project_name, self.project_path)
    243 

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\ansys.py in load_ansys_project(proj_name, project_path, extension)
   3092             )
   3093 
-> 3094     app = HfssApp()
   3095     logger.info("\tOpened Ansys App")
   3096 

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\ansys.py in __init__(self, ProgID)
    379         '''
    380         super(HfssApp, self).__init__()
--> 381         self._app = Dispatch(ProgID)
    382 
    383     def get_app_desktop(self):

~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\__init__.py in Dispatch(dispatch, userName, resultCLSID, typeinfo, UnicodeToString, clsctx)
     93   """
     94   assert UnicodeToString is None, "this is deprecated and will go away"
---> 95   dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
     96   return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)
     97 

~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatchAndUserName(IDispatch, userName, clsctx)
    112         else:
    113                 userName = str(userName)
--> 114         return (_GetGoodDispatch(IDispatch, clsctx), userName)
    115 
    116 def _GetDescInvokeType(entry, invoke_type):

~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
     89                         IDispatch = pythoncom.connect(IDispatch)
     90                 except pythoncom.ole_error:
---> 91                         IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
     92         else:
     93                 # may already be a wrapped class.

com_error: (-2147221005, 'Invalid class string', None, None)

There was the same problem for the previous setup, which could be resolved by reinstalling everything from scratch. Ideas for an easier fix?

@github-actions
Copy link

github-actions bot commented Jul 8, 2021

👏👏👏 You are awesome! Thank you for making your first issue to pyEPR ' first issue

@zlatko-minev
Copy link
Owner

Try the Qiskit Metal slack channel, you can ask this there, https://qiskit.org/documentation/metal/ (Slack channel #metal in the qiskit workspace.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants