-
Notifications
You must be signed in to change notification settings - Fork 20
Dylink doesn't allow us to call functions that start with '_' #164
Copy link
Copy link
Open
Description
Note: This was SeattleTestbed/repy_v2#60 previously. I'm just attaching it to the correct issue tracker, but have not reviewed it for aptness.
If we import a file using dylink, it won't allow us to call functions that start with an underscore. This is different from how python import works. Not sure if this is an intended behaviour or not. Below is a piece of code that fails.
foo.py:
def _foo():
print "foo"
bar.py:
from repyportability import *
add_dy_support(locals())
foo = dy_import_module("foo.py")
try:
foo._foo()
except AttributeError, err:
print "Unable to call foo._foo() when using dylink.\n" + str(err)
import foo
foo._foo()
If we run bar.py, we get the following error when calling foo._foo() (when using dylink):
monzum@TestUbuntu:$ python bar.py
Unable to call foo._foo() when using dylink.
ImportedModule instance has no attribute '_foo'
However once we use 'import' to import it, we are able to call foo._foo().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels