Open dfdthor opened 5 years ago
import ipystata from ipystata.config import config_stata config_stata('C:/Program Files (x86)/Stata14')
executes without error and the above error occurs after restarting the kernel
C:\Program Files (x86)\Stata14>ls ado docs STATA.LIC vcomp100.dll auto.dta isstata.140 StataMP-64.exe DLXAPI32.DLL Microsoft.VC90.OPENMP StataMP-64_old.exe DLXAPI64.DLL stata.html utilities
C:\Program Files (x86)\Stata14>StataMP-64.exe /Register
C:\Program Files (x86)\Stata14>
ran without error as the the import ipystata bit and restarting the kernel.
get_ipython().run_cell_magic('stata', '-o car_df', 'sysuse auto.dta')
still gives
UsageError: Cell magic %%stata
not found.
the same for me, anyone dealt with it?
@huozi07 let's see if we can figure out what is wrong. Some questions:
The same for me, any ideas?
stata installed, batch mode works
@karajimys this is not necessarily a problem with ipystata, it is more likely a problem with win32 not being able to run/find Stata.
I assume you get the same error if you run the below in a Jupyter Notebook?
import win32com.client as win32
win32.Dispatch("stata.StataOLEApp")
@TiesdeKok thank you for the answer. Yes exactly the same error. Any ideas on how could this be solved?
Ok, that implies that the register step wasn't successful. Did you try to follow the registration steps (https://www.stata.com/automation/#createmsapp) but with an elevated command prompt (i.e. right click on CMD and click "run as administrator")?
help!this question ,how can i deal it
This method solves my problem. It should be a user permission problem, and /Register
operation should be performed with administrator permission. I hope it will be helpful to the people behind.
Method 1: Create a new cmd/powershell with administrator privileges, and then execute: "C:\Program Files (x86)\Stata15\StataSE-64.exe" /Register
.
Method 2: Create a StataSE-64.exe shortcut, right-click
-properties
-target
set "C:\Program Files (x86)\Stata15\StataSE-64.exe" /Register
, and then right-click to run with administrator privileges.
thanks @TiesdeKok https://www.stata.com/automation/#createmsapp
%%stata
display "Hello, I am printed in Stata."
produces
com_error Traceback (most recent call last) C:\Users\Public\Anaconda3\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)