What steps will reproduce the problem?
1. Add sys.path.append('/path/to/another/pythonpath/directory') to
get_user_idadir()/idapythonrc.py
i.e.
sys.path.append('/path/to/custom-module/')
2. Try to import a module located in the pythonpath from IDAPython's
commandline.
i.e.
import mymodule
3. print sys.path and notice that none of your sys.path that you set in
idapythonrc.py actually persisted.
print '/path/to/custom-module/' in sys.path
What is the expected output? What do you see instead?
It is expected that idapythonrc.py could be used to setup the python search
path in IDA.
What version of the product are you using? On what operating system?
IDAPython 2.0.0
Please provide any additional information below.
The reason why this is happening is because idaapi.IDAPython_ExecScript in
init.py is being used to execute the user's idapythonrc.py. This function saves
sys.path and globals, calls execfile, and then restores them after execution.
Due to this being used instead of execfile, one can't use idapythonrc.py to set
the default python environment as IDA starts up. To fix, you can change
idaapi.IDAPython_ExecScript to just execfile inside init.py.
Original issue reported on code.google.com by arizv...@gmail.com on 31 Jan 2015 at 8:57
Original issue reported on code.google.com by
arizv...@gmail.com
on 31 Jan 2015 at 8:57