SublimeStataEnhanced icon indicating copy to clipboard operation
SublimeStataEnhanced copied to clipboard

Problem with Stata's version?

Open alinemsm opened this issue 8 years ago • 12 comments

Hi,

I'm getting the error below when sending a line to Stata. I'm using Stata 13.1 in Mac OSX.

Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./text_2_stata.py", line 168, in run
  File "./text_2_stata.py", line 54, in get_stata_version
ValueError: zero length field name in format

Thank you!

alinemsm avatar Aug 07 '16 12:08 alinemsm

Does this happen with any line? What version of Stata do you have (StataMP, StataSE, etc.)?

elbersb avatar Aug 08 '16 22:08 elbersb

I have Stata/IC 13.1. It was working fine before the latest package update. Yes, it happens with whatever line I run.

alinemsm avatar Aug 08 '16 22:08 alinemsm

It seems to be an error with your python version. Can you run import sys; print(sys.version) in your sublime console?

elbersb avatar Aug 09 '16 08:08 elbersb

I get

>>> import sys; print(sys.version) 2.6.9 (unknown, Oct 23 2015, 19:19:20) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] But I do have the latest python version installed. Can I point sublime to the other version?

alinemsm avatar Aug 09 '16 18:08 alinemsm

I don't know how to change the python version in Sublime, but it's very easy to fix, and this way we can support Python 2.6 again. Please see this file: https://github.com/elbersb/SublimeStataEnhanced/blob/master/text_2_stata.py You can manually replace your local file with this file and then it should work again.

@andrewheiss I made a pull request for this.

elbersb avatar Aug 09 '16 19:08 elbersb

@elbersb thanks for this!

I've done as you said and am getting

Unknown macro command text_2_stata

alinemsm avatar Aug 09 '16 20:08 alinemsm

I can't possibly understand how this change produces this error message... Which version of Sublime are you using? I think in Sublime 3, Python 3 is used by default.

elbersb avatar Aug 10 '16 09:08 elbersb

Sorry about the late reply. I use Sublime Text 2. I did a clean install in ST2 and the plugin and replaced the text_2_stata.py file by yours. Now am getting something similar to the previous error.

Writing file /Users/Al/Library/Application Support/Sublime Text 2/Packages/Stata Enhanced/text_2_stata.py with encoding UTF-8
Reloading plugin /Users/Al/Library/Application Support/Sublime Text 2/Packages/Stata Enhanced/text_2_stata.py
Writing file /Users/Al/Library/Application Support/Sublime Text 2/Packages/Stata Enhanced/text_2_stata.py with encoding UTF-8
Reloading plugin /Users/Al/Library/Application Support/Sublime Text 2/Packages/Stata Enhanced/text_2_stata.py
Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./text_2_stata.py", line 168, in run
  File "./text_2_stata.py", line 86, in get_stata_version
AttributeError: 'module' object has no attribute 'check_output'

alinemsm avatar Aug 14 '16 12:08 alinemsm

This error is again related to the old Python version. It would be nice to support Python 2.6 completely, but I can't take care of this right now. If it's not possible to switch to Sublime 3, then maybe the easiest way is to install the old version of the plugin?

elbersb avatar Aug 19 '16 11:08 elbersb

I am now using Sublime 3 and the plugin works well. Many thanks for your help!

alinemsm avatar Aug 19 '16 11:08 alinemsm

Great! @andrewheiss Do you want to support Sublime 2? If not, this can be closed.

elbersb avatar Aug 19 '16 11:08 elbersb

Can Stata Enhanced be used on Sublime Text 2 on Mac? Cmd + enter doesn't respond when I try executing the outside stata. I use StataMP.

uttara-cmu avatar Mar 08 '17 01:03 uttara-cmu