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

Julia object has no attribute Any #144

Closed
zekeriyasari opened this issue Jan 18, 2018 · 2 comments
Closed

Julia object has no attribute Any #144

zekeriyasari opened this issue Jan 18, 2018 · 2 comments

Comments

@zekeriyasari
Copy link

zekeriyasari commented Jan 18, 2018

Although it is possible to access any built-in Julia function, it is not possible to access any of the Julia built-in Julia types. For example, the script

from julia import Julia
jul = Julia()
print(jul.sind)
print(jul.Any)

gives the output:

<PyCall.jlwrap sind>
Traceback (most recent call last):
  File "/user/zekeriya.sari/Documents/AtomProjects/PyJUlia/test.py", line 5, in <module>
    print(jul.Any)
AttributeError: 'Julia' object has no attribute 'Any'

I did not see any information about this issue in the documentation and in the test codes of pyjulia. I wonder if it is possible to access these built-in Julia types in python side. (See JuliaPy/PyCall.jl#460). Any suggestions?

@stevengj
Copy link
Member

stevengj commented Jan 18, 2018

Yes, it looks like it currently only exports the functions in Base (https://github.com/JuliaPy/pyjulia/blob/master/julia/core.py#L386), and similarly for other modules.

Honestly, the whole current approach seems less than ideal to me… I feel like it should load symbols in the module(s) lazily, rather than adding them all as attributes when the module is loaded. This would improve load times and also be more flexible about non-function symbols (e.g. mutable globals would work, because the conversion would occur each time they are accessed).

For now, you can presumably do jul.eval("Any")?

@zekeriyasari
Copy link
Author

jul.eval("Any") works fine. Thank you for all.

tkf added a commit to tkf/pyjulia that referenced this issue May 16, 2018
tkf added a commit to tkf/pyjulia that referenced this issue May 16, 2018
tkf added a commit to tkf/pyjulia that referenced this issue May 16, 2018
tkf added a commit to tkf/pyjulia that referenced this issue Jun 20, 2018
tkf added a commit to tkf/pyjulia that referenced this issue Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants