Skip to content

Commit

Permalink
Fix import error if bootstrapping is not yet completed
Browse files Browse the repository at this point in the history
Fixes #1644

If package_control injector code has not yet been written (first start with
PC4.0 installed), an import error was thown due to missing module.

Regressed by 8e11321

This commit therefore falls back to relative import, in case bootstrapping is
not yet completed.
  • Loading branch information
deathaxe committed Jul 19, 2023
1 parent 36248a4 commit 85c6590
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions package_control/package_disabler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@

import sublime

# Relative import may not work here due to hard loading events
# into global package_control (see bootstrap.py)!
from package_control import events
try:
# Relative import does not work here due to hard loading events
# into global package_control (see bootstrap.py)!
from package_control import events
except ImportError:
# use relative import, if bootstrapping has not yet been completed
from . import events

from .console_write import console_write
from .package_io import package_file_exists, read_package_file
Expand Down

0 comments on commit 85c6590

Please sign in to comment.