Added to readme and bugfix in import hook
This commit is contained in:
@@ -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
|
If you have a file containing _ code, you can import it after importing
|
||||||
_. Cool, huh?
|
_. 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
|
The idea behind it is using Pythons import hooks to achieve something similar
|
||||||
to mames' original script, only that it works the opposite way.
|
to mames' original script, only that it works the opposite way.
|
||||||
|
|
||||||
|
@@ -91,8 +91,8 @@ class Finder:
|
|||||||
filename = os.path.join(dirname, fullname)
|
filename = os.path.join(dirname, fullname)
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
return UnderScoreLoader(filename)
|
return UnderScoreLoader(filename)
|
||||||
else if os.path.exists(filename + ".py"):
|
else if os.path.exists(filename + ".us"):
|
||||||
return UnderScoreLoader(filename + ".py")
|
return UnderScoreLoader(filename + ".us")
|
||||||
|
|
||||||
class UnderScoreLoader:
|
class UnderScoreLoader:
|
||||||
"""Custom module loader for _ files."""
|
"""Custom module loader for _ files."""
|
||||||
|
Reference in New Issue
Block a user