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

Use local namespace #27

Open
tmr232 opened this issue Feb 17, 2016 · 4 comments
Open

Use local namespace #27

tmr232 opened this issue Feb 17, 2016 · 4 comments

Comments

@tmr232
Copy link
Contributor

tmr232 commented Feb 17, 2016

Currently, the IPython console and the regular Python console inside IDA have different namespaces.

Is it possible to merge those namespaces?

@james91b
Copy link
Owner

Should be possible, just change

https://github.com/james91b/ida_ipython/blob/master/python/ipythonEmbed.py#L64-L65

to

        app.kernel.user_module = __main__
        app.kernel.user_ns = __main__.__dict__

When i first did this, older versions in iPython i used to have strange issues with the auto completion and the completer frame. However, after my simple tests, it seems to work fine in Jupyter. So this is a change we could make.

@tmr232
Copy link
Contributor Author

tmr232 commented Mar 21, 2016

Yes, it works 😄

Now I wonder if that indeed a good idea - as the global namespace is extremely messy.

@james91b
Copy link
Owner

Yeah, I'm not actually sure what would be more useful. Global namespace can make some thing easier, however it can be messy and if you ever want to affect the global namespace from a notebook you should be able to just import main and do it that way.

We could also make it an option to launch the notebook in a new namespace or the global namespace.

@tmr232
Copy link
Contributor Author

tmr232 commented Mar 22, 2016

The main (and only) use I see for keeping the global namespace is interaction with plugins. I think it is a worthwhile cause. If we have a way to get the all the data from that scope without dirtying the new one, that would be great.

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