Skip to content

Commit

Permalink
Fixed an issue when trying to open a Python module with openCodeFile …
Browse files Browse the repository at this point in the history
…function
  • Loading branch information
CyrilleB79 committed Nov 25, 2024
1 parent 6481adb commit ac738ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addon/globalPlugins/ndtt/fileOpener.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ def openObject(objPath):
tokens = objPath.split('.')
for iToken in range(len(tokens)):
modName = '.'.join(tokens[0:iToken + 1])
objName = '.'.join(tokens[iToken + 1:])
inModuleTokens = tokens[iToken + 1:]
if inModuleTokens:
objName = '.'.join(inModuleTokens)
else:
objName = None
try:
mod = importFunction(modName)
# Python 2 raise ImportError for non-existing modules; Python 3 raises ModuleNotFoundError instead.
Expand All @@ -271,7 +275,7 @@ def openObject(objPath):


def openObjectInModule(objName, mod):
tokens = objName.split('.')
tokens = objName.split('.') if objName else []
obj = mod
try:
for attr in tokens:
Expand Down

0 comments on commit ac738ff

Please sign in to comment.