Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codeCompletion.py line 118 "NameError: global name 'TranslationUnit' is not defined" #2

Closed
yh-sb opened this issue Jan 21, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@yh-sb
Copy link

yh-sb commented Jan 21, 2016

Windows 7 64 bit, Sublime Text 3083 32 bit, Clang 3.7.0:
I get this when Sublime Text is loading:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Sublime Text\Sublime Text\sublime_plugin.py", line 158, in on_api_ready
    m.plugin_loaded()
  File "C:\Program Files (x86)\Sublime Text\Sublime Text\Data\Packages\clangHelper\codeCompletion.py", line 48, in plugin_loaded
    set_view(view)
  File "C:\Program Files (x86)\Sublime Text\Sublime Text\Data\Packages\clangHelper\codeCompletion.py", line 118, in set_view
    CodeCompletion.translation_units[view.id()] = TranslationUnit.from_source(
NameError: global name 'TranslationUnit' is not defined

Also looks like autocomplete doesn't work.

@griebd
Copy link
Owner

griebd commented Jan 21, 2016

your LLVM instal is 32 or 64 bits?
yes, auto complete won't work because the python bindings are having some kind of error...

@griebd griebd added the Windows label Jan 21, 2016
@griebd griebd self-assigned this Jan 21, 2016
@griebd griebd added this to the 0.1.0 milestone Jan 21, 2016
@yh-sb
Copy link
Author

yh-sb commented Jan 21, 2016

LLVM is 32 bit

@griebd
Copy link
Owner

griebd commented Jan 22, 2016

Could you try commenting lines 14 to 32 except by line 30 (your version of LLVM) removing the indentation. I want to check if the problem is the system LLVM python bindings, with this change you will be using a modified one.
Something like:

# try:
#     from clang.cindex import TranslationUnit
# # use customized clang python bindings
# except:
#     from clangHelper.tools.libclang_version import get_libclang_version
#     if get_libclang_version() == '32':
#         from clangHelper.clang.cindex32 import TranslationUnit
#     if get_libclang_version() == '33':
#         from clangHelper.clang.cindex33 import TranslationUnit
#     if get_libclang_version() == '34':
#         from clangHelper.clang.cindex34 import TranslationUnit
#     if get_libclang_version() == '35':
#         from clangHelper.clang.cindex35 import TranslationUnit
#     if get_libclang_version() == '36':
#         from clangHelper.clang.cindex36 import TranslationUnit
#     elif get_libclang_version() == '37':
from clangHelper.clang.cindex37 import TranslationUnit
#     if get_libclang_version() == '38':
#         from clangHelper.clang.cindex38 import TranslationUnit

and then report back please. Thanks.

@yh-sb
Copy link
Author

yh-sb commented Jan 10, 2019

Hi, I close this issue because I don't use sublimetext for a while.
Feel free to open it if you meet with this issue in the future

@yh-sb yh-sb closed this as completed Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants