Home Download Buy Blog Forum Support

Sublime Clang ST3 Error

Sublime Clang ST3 Error

Postby nikhilkalige on Thu Jul 11, 2013 1:43 pm

I am getting an error in ST3 for sublimeclang whenever the folder name starts with the letter g..... the console shows the following

Writing file /D/g12/a.c with encoding UTF-8 (atomic)
Traceback (most recent call last):
File "C:\Users\Nikhil\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\sublimeclang.py", line 504, in recompile
self.reparse_done):
File "C:\Users\Nikhil\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\internals\translationunitcache.py", line 1154, in reparse
(filename, self.get_opts(view), self.get_opts_script(view), unsaved_files, on_done)))
File "C:\Users\Nikhil\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\internals\translationunitcache.py", line 1191, in get_opts_script
return expand_path(get_setting("options_script", "", view), view.window())
File "C:\Users\Nikhil\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\internals\common.py", line 162, in expand_path
value = re.sub(r'\${project_path}', project_path, value)
File "X/re.py", line 170, in sub
File "X/re.py", line 288, in _subx
File "X/functools.py", line 258, in wrapper
File "X/re.py", line 279, in _compile_repl
File "X/sre_parse.py", line 778, in parse_template
sre_constants.error: bad group name
nikhilkalige
 
Posts: 7
Joined: Tue Jul 09, 2013 8:55 pm

Re: Sublime Clang ST3 Error

Postby kblomqvist on Thu Jul 11, 2013 4:36 pm

Hmm... my first guess is that the project_path is not properly escaped when used in re.sub(). Directories starting with \g (in Windows) include an unwanted \g regex notation.
kblomqvist
 
Posts: 17
Joined: Fri Nov 16, 2012 4:14 pm

Re: Sublime Clang ST3 Error

Postby nikhilkalige on Fri Jul 12, 2013 6:17 am

What do you suggest is the solution ???
nikhilkalige
 
Posts: 7
Joined: Tue Jul 09, 2013 8:55 pm

Re: Sublime Clang ST3 Error

Postby kblomqvist on Sun Jul 14, 2013 1:09 pm

I was able to reproduce this and fix it... just replaced the lines 161-2 in internals/common.py with this:

Code: Select all

project_path = project_path.replace("\\", "\\\\") # Path will be used within a regex, thus escape every backslash
if project_path:
    value = re.sub(r'\${project_path}', project_path, value)


EDIT: Escaper should have been put in to the if clause :roll:
Code: Select all
if project_path:
    project_path = project_path.replace("\\", "\\\\") # Path will be used within a regex, thus escape every backslash
    value = re.sub(r'\${project_path}', project_path, value)
Last edited by kblomqvist on Sun Jul 14, 2013 3:26 pm, edited 1 time in total.
kblomqvist
 
Posts: 17
Joined: Fri Nov 16, 2012 4:14 pm

Re: Sublime Clang ST3 Error

Postby kblomqvist on Sun Jul 14, 2013 2:09 pm

Have you got the following error? Don't know what trigged this, but it seems to be harmless (doesn't cause any visible errors for the end user).

Code: Select all
Writing file /C/Users/Kim/Documents/Workspace/gtest/main.cpp with encoding UTF-8 (atomic)
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 287, in on_selection_modified
    callback.on_selection_modified(v)
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\errormarkers.py", line 223, in on_selection_modified
    clang_error_panel.highlight_panel_row()
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\errormarkers.py", line 116, in highlight_panel_row
    row, col = view.rowcol(view.sel()[0].a)
AttributeError: 'NoneType' object has no attribute 'rowcol'
kblomqvist
 
Posts: 17
Joined: Fri Nov 16, 2012 4:14 pm

Re: Sublime Clang ST3 Error

Postby kblomqvist on Sun Jul 14, 2013 3:22 pm

Just got this IndexError as well (again seems to be invisible for the end user):

Code: Select all
Traceback (most recent call last):
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\sublimeclang.py", line 488, in reparse_done
    display_compilation_results(self.view)
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\sublimeclang.py", line 247, in display_compilation_results
    tu = get_translation_unit(view)
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\sublimeclang.py", line 78, in get_translation_unit
    stat = warm_up_cache(view, filename)
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\sublimeclang.py", line 70, in warm_up_cache
    translationunitcache.tuCache.add(view, filename)
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\internals\translationunitcache.py", line 1179, in add
    opts = self.get_opts(view)
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\internals\translationunitcache.py", line 1219, in get_opts
    language = get_language(view)
  File "C:\Users\Kim\AppData\Roaming\Sublime Text 3\Packages\SublimeClang\internals\common.py", line 93, in get_language
    caret = view.sel()[0].a
  File "C:\Program Files\Sublime Text 3\sublime.py", line 450, in __getitem__
    raise IndexError()
IndexError
kblomqvist
 
Posts: 17
Joined: Fri Nov 16, 2012 4:14 pm

Re: Sublime Clang ST3 Error

Postby nikhilkalige on Mon Jul 15, 2013 7:59 am

kblomqvist wrote:Have you got the following error? Don't know what trigged this, but it seems to be harmless (doesn't cause any visible errors for the end user).


I havent got the error you mentioned... but will see if it appears... regarding the issue with folders starting with g your fix solved the issue..... great work... thanks a lot..... Hope this helps other c developers looking for sublimeclang in ST3 :D
nikhilkalige
 
Posts: 7
Joined: Tue Jul 09, 2013 8:55 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 25 guests