andrewheiss / SublimeStataEnhanced

Plugin that adds support for Stata 11–15 for Sublime Text 2 and 3
56 stars 22 forks source link

Problem with Stata's version? #47

Open alinemsm opened 8 years ago

alinemsm commented 8 years ago

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!

elbersb commented 8 years ago

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

alinemsm commented 8 years ago

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

elbersb commented 8 years ago

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

alinemsm commented 8 years ago

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?

elbersb commented 8 years ago

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.

alinemsm commented 8 years ago

@elbersb thanks for this!

I've done as you said and am getting

Unknown macro command text_2_stata

elbersb commented 8 years ago

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.

alinemsm commented 8 years ago

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'
elbersb commented 8 years ago

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?

alinemsm commented 8 years ago

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

elbersb commented 8 years ago

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

uttara-cmu commented 7 years ago

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.