From d4331273b93964e34d8c974b123badfb65b22bba Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 13 Oct 2014 15:41:46 +0200 Subject: [PATCH] Added to readme and bugfix in import hook --- README.md | 3 +++ _/__init__.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b269d6..6a032f2 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ As in mames' original version, you can create such a __script__ easily: If you have a file containing _ code, you can import it after importing _. Cool, huh? +Please note that the file you are importing is either an `.us` file or import +it by the fully qualified name(e.g. `import \_.py`). + The idea behind it is using Pythons import hooks to achieve something similar to mames' original script, only that it works the opposite way. diff --git a/_/__init__.py b/_/__init__.py index 519deec..f6bc0b8 100644 --- a/_/__init__.py +++ b/_/__init__.py @@ -91,8 +91,8 @@ class Finder: filename = os.path.join(dirname, fullname) if os.path.exists(filename): return UnderScoreLoader(filename) - else if os.path.exists(filename + ".py"): - return UnderScoreLoader(filename + ".py") + else if os.path.exists(filename + ".us"): + return UnderScoreLoader(filename + ".us") class UnderScoreLoader: """Custom module loader for _ files."""