main icon indicating copy to clipboard operation
main copied to clipboard

IronPython module import issues with IPython 1.0 - AttributeError: 'module' object has no attribute 'core'

Open kerray opened this issue 13 years ago • 6 comments

I've originally tried to get to the bottom of this in ipython/ipython#4062

My question here is, why do the imports in IronPython behave differently than in cPython? Any ideas what would be the right way to solve/work around this?

Thanks

kerray avatar Sep 03 '13 08:09 kerray

I ran into this myself over the weekend and I couldn't quite figure it out either. Directly importing IPython.core immediately before it doesn't work either. I'm think there must be something special about the IPython module namespace that's tripping up IronPython, but I haven't figured out what it is yet.

jdhardy avatar Sep 03 '13 13:09 jdhardy

Any ideas anyone? I have the same problem though using suggestions ipython/ipython#4062 I still get issues.

bfibrich avatar Oct 01 '13 11:10 bfibrich

(copied this from same response in issue linked above).

There does seem to be some bug in IronPython 2.7.x (9cbff4cfde6d2071a8158c54535cd1bc83c82e32) with ipython-2.0.0-dev ebf12123833c207995a03dc9bb542ecf35cc1dcc related to the way modules are imported which breaks the ipython "shell" script.

I found this code successful

from IPython import core as C
import IPython
IPython.core = C
from IPython import start_ipython
start_ipython()

It's something to do with the PlatformAdaptionLayer and wierd behaviour with nested packages in IronPython which I can't quite pin down. However the workaround is "working" at the moment.

swinstanley avatar Oct 18 '13 13:10 swinstanley

I have commited a fix in IronPython (94b55df in ipy-2.7-maint) Details: https://ironpython.codeplex.com/workitem/34551

On Fri, Oct 18, 2013 at 3:17 PM, swinstanley [email protected]:

(copied this from same response in issue linked above).

There does seem to be some bug in IronPython 2.7.x (9cbff4chttps://github.com/IronLanguages/main/commit/9cbff4cfde6d2071a8158c54535cd1bc83c82e32) with ipython-2.0.0-dev ebf1212https://github.com/IronLanguages/main/commit/ebf12123833c207995a03dc9bb542ecf35cc1dccrelated to the way modules are imported which breaks the ipython "shell" script.

I found this code successful

from IPython import core as Cimport IPythonIPython.core = Cfrom IPython import start_ipythonstart_ipython()

It's something to do with the PlatformAdaptionLayer and wierd behaviour with nested packages in IronPython which I can't quite pin down. However the workaround is "working" at the moment.

— Reply to this email directly or view it on GitHubhttps://github.com/IronLanguages/main/issues/123#issuecomment-26594500 .

paweljasinski avatar Oct 18 '13 14:10 paweljasinski

Looks like this has been fixed and can be closed?

varzan avatar Jan 31 '14 18:01 varzan

Just for the record I will maintain forks/branches for the purpose of using ipython under IronPython.

https://github.com/paweljasinski/IronLanguages/tree/ipython-notepad - patches in IronPython https://github.com/paweljasinski/pyzmq/tree/iron-cleanup - pyzmq - ctype backend for IronPython https://github.com/paweljasinski/tornado/tree/iron-wip - patches in tornado https://github.com/paweljasinski/ipython/tree/iron-notepad - patches in ipython https://github.com/paweljasinski/pyreadline - patches in readline

Once merged into the official tree, branches will disappear. ipython and tornado will stay forever, as there is no intention to merge 2.x based IronPython changes into the master.

paweljasinski avatar Feb 03 '14 16:02 paweljasinski