This repository was archived by the owner on Nov 2, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +20
-7
lines changed Expand file tree Collapse file tree 7 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 7474 and in Windows this could be like: C:\\Python27\\python.exe
7575 */
7676
77- "path_to_python3 " : " /usr/bin/python" ,
77+ "path_to_python " : " /usr/bin/python" ,
7878
7979 /*
8080 Module search path defines a list of paths where the
Original file line number Diff line number Diff line change @@ -161,8 +161,5 @@ def rf_data(self, file_path):
161161 return None
162162
163163 def is_string (self , str_ ):
164- if version_info .major > 2 :
165- status = isinstance (str_ , str )
166- else :
167- raise RuntimeError ('Plugin only works with python 3' )
168- return status
164+ return isinstance (str_ , str )
165+
Original file line number Diff line number Diff line change 1+ import subprocess
12from .command_logging import LogCommands
23from .index_open_tab import IndexOpenTabCommand
34from .jump_to_keyword import JumpToKeyword
1112from .setting_import_helper import InsertImport
1213from .setting_import_helper import SettingImporter
1314from .show_documentation import ShowKeywordDocumentation
15+ from sublime import error_message
1416
1517__all__ = [
1618 'IndexOpenTabCommand' ,
2729 'SettingImporter' ,
2830 'ShowKeywordDocumentation'
2931]
32+
33+ def check_binary_version (python_binary ):
34+ result = subprocess .check_output ([python_binary ,"-c" , "import sys;print(sys.version_info.major)" ])
35+ version = int (result .decode ('utf-8' ).strip ())
36+ if version < 3 :
37+ error_message ('RobotFrameworkAssistant\n ' +
38+ '***********************************\n ' +
39+ 'Plugin fully support on python 3\n ' )
Original file line number Diff line number Diff line change 33import subprocess
44from platform import system
55from os import path , makedirs
6+ from . import check_binary_version
67from ..setting .setting import get_setting
78from ..setting .setting import SettingObject
89
@@ -34,6 +35,7 @@ def run(self, edit):
3435 Also all imports, from found files, will be iterated and
3536 table is created also from imports.
3637 """
38+ check_binary_version (get_setting (SettingObject .python_binary ))
3739 log_file = get_setting (SettingObject .log_file )
3840 makedirs (path .dirname (log_file ), exist_ok = True )
3941 file_ = open (log_file , 'a' )
Original file line number Diff line number Diff line change 55from os import path , makedirs
66from hashlib import md5
77import json
8+ from . import check_binary_version
89from ..setting .setting import get_setting
910from ..setting .setting import SettingObject
1011from ..setting .db_json_settings import DBJsonSetting
@@ -45,6 +46,7 @@ def add_builtin_vars(db_path):
4546class ScanIndexCommand (sublime_plugin .TextCommand ):
4647
4748 def run (self , edit ):
49+ check_binary_version (get_setting (SettingObject .python_binary ))
4850 log_file = get_setting (SettingObject .log_file )
4951 db_dir = get_setting (SettingObject .table_dir )
5052 makedirs (path .dirname (log_file ), exist_ok = True )
Original file line number Diff line number Diff line change 33import subprocess
44from platform import system
55from os import path , makedirs
6+ from . import check_binary_version
67from ..setting .setting import get_setting
78from ..setting .setting import SettingObject
89from .scan import scan_popen_arg_parser
@@ -16,6 +17,7 @@ def run(self, edit):
1617 Purpose of the command is scan and create the db table
1718 from the currently open tab.
1819 """
20+ check_binary_version (get_setting (SettingObject .python_binary ))
1921 log_file = get_setting (SettingObject .log_file )
2022 makedirs (path .dirname (log_file ), exist_ok = True )
2123 open_tab = self .view .file_name ()
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class SettingObject(object):
5151 scanner_runner = 'scanner_runner'
5252 index_runner = 'index_runner'
5353 log_file = 'log_file'
54- python_binary = 'path_to_python3 '
54+ python_binary = 'path_to_python '
5555 workspace = 'robot_framework_workspace'
5656 extension = 'robot_framework_extension'
5757 builtin_variables = 'robot_framework_builtin_variables'
You can’t perform that action at this time.
0 commit comments