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

Bug/#8 #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions kaki/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from kivy.factory import Factory
from kivy.lang import Builder
from kivy.base import ExceptionHandler, ExceptionManager
from kivy.utils import platform
try:
from monotonic import monotonic
except ImportError:
Expand Down Expand Up @@ -254,6 +255,7 @@ def _reload_from_watchdog(self, event):
except Exception as e:
import traceback
self.set_error(repr(e), traceback.format_exc())
print(f"Error: {e} \n{traceback.format_exc()}")
return

Logger.debug("{}: Reload triggered by {}".format(self.appname, event))
Expand Down Expand Up @@ -306,9 +308,13 @@ def _filename_to_module(self, filename):
rootpath = self.get_root_path()
if filename.startswith(rootpath):
filename = filename[len(rootpath):]
if filename.startswith(os.path.sep):
if platform == 'macosx':
prefix = os.sep
else:
prefix = os.path.sep
if filename.startswith(prefix):
filename = filename[1:]
module = filename[:-3].replace(os.path.sep, ".")
module = filename[:-3].replace(prefix, ".")
Logger.debug("{}: Translated {} to {}".format(
self.appname, orig_filename, module))
return module
Expand Down