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

Dylink doesn't allow us to call functions that start with '_' #1386

Open
choksi81 opened this issue May 25, 2014 · 0 comments
Open

Dylink doesn't allow us to call functions that start with '_' #1386

choksi81 opened this issue May 25, 2014 · 0 comments

Comments

@choksi81
Copy link

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().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants