mattiasnordin / StataEditor

Stata Editor for Sublime Text 3
47 stars 18 forks source link

Stata 16 #38

Closed wesleyhon closed 4 years ago

wesleyhon commented 5 years ago

Hi, I would appreciate it if this editor supports Stata 16 version. Looking forward to the update. Many thanks!

mattiasnordin commented 5 years ago

I don't have access to Stata 16 at the moment, but if/when I do, I'll try to add it. Have you tried whether it works right now?

wesleyhon commented 5 years ago

I don't have access to Stata 16 at the moment, but if/when I do, I'll try to add it. Have you tried whether it works right now?

Thanks for your reply! I checked again just now, and still failed to execute do-files under the environment of Stata 16.

mattiasnordin commented 5 years ago

Ok, what happens if you open the console and write

import win32com.client
win32com.client.Dispatch ("stata.StataOLEApp")
nicolas-suarez commented 5 years ago

Hi, perhaps wesleyhon have a particular issue, but I got Stata Editor working with Stata 16 in 2 computers (both with Windows 10)

wesleyhon commented 4 years ago

I've figured this out. My Stata Editor runs well now! Thank you guys!

TSSlade commented 3 years ago

What wound up being the solution, @wesleyhon ? I have a similar challenge to yours. (Or @nicolas-suarez - can you contribute your solution?)

My console error trace is as follows, @mattiasnordin :

Unable to open /C/Users/tslade/AppData/Roaming/Sublime Text 3/Packages/Default/Preferences.sublime-settings
Traceback (most recent call last):
  File "C:\Users\tslade\AppData\Roaming\Sublime Text 3\Installed Packages\StataEditor.sublime-package\StataEditorPlugin.py", line 63, in StataAutomate
AttributeError: 'module' object has no attribute 'stata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\tslade\AppData\Roaming\Sublime Text 3\Packages\Pywin32\lib\x64\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 1082, in run_
    return self.run(edit, **args)
  File "C:\Users\tslade\AppData\Roaming\Sublime Text 3\Installed Packages\StataEditor.sublime-package\StataEditorPlugin.py", line 158, in run
  File "C:\Users\tslade\AppData\Roaming\Sublime Text 3\Installed Packages\StataEditor.sublime-package\StataEditorPlugin.py", line 71, in StataAutomate
  File "C:\Users\tslade\AppData\Roaming\Sublime Text 3\Packages\Pywin32\lib\x64\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Users\tslade\AppData\Roaming\Sublime Text 3\Packages\Pywin32\lib\x64\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Users\tslade\AppData\Roaming\Sublime Text 3\Packages\Pywin32\lib\x64\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
TSSlade commented 3 years ago

Just guessing: was the solution to follow the Windows-Vista instructions despite being on Windows 10?

To register the Stata Automation type library on Windows Vista, do the following steps: In the installation directory, right-click on the Stata executable, for example, StataSE.exe. Choose "Create Shortcut". Right-click on the newly created "Shortcut to StataSE.exe", choose "Property", and change the Target from "C:\Program Files\Stata13\StataSE.exe" to "C:\Program Files\Stata13\StataSE.exe" /Register. Click "OK". Right-click on the updated "Shortcut to StataSE.exe"; choose "Run as administrator".