You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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().
The text was updated successfully, but these errors were encountered:
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:
bar.py:
If we run bar.py, we get the following error when calling foo._foo() (when using dylink):
However once we use 'import' to import it, we are able to call foo._foo().
The text was updated successfully, but these errors were encountered: