{"action":"created","issue":{"url":"https://api.github.com/repos/spyder-ide/spyder/issues/107","labels_url":"https://api.github.com/repos/spyder-ide/spyder/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/spyder-ide/spyder/issues/107/comments","events_url":"https://api.github.com/repos/spyder-ide/spyder/issues/107/events","html_url":"https://github.com/spyder-ide/spyder/issues/107","id":57863195,"number":107,"title":"Hysteresis upon \"Restart Python interpreter\"","user":{"login":"spyder-issues-migrator","id":11021581,"avatar_url":"https://avatars.githubusercontent.com/u/11021581?v=3","gravatar_id":"","url":"https://api.github.com/users/spyder-issues-migrator","html_url":"https://github.com/spyder-issues-migrator","followers_url":"https://api.github.com/users/spyder-issues-migrator/followers","following_url":"https://api.github.com/users/spyder-issues-migrator/following{/other_user}","gists_url":"https://api.github.com/users/spyder-issues-migrator/gists{/gist_id}","starred_url":"https://api.github.com/users/spyder-issues-migrator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spyder-issues-migrator/subscriptions","organizations_url":"https://api.github.com/users/spyder-issues-migrator/orgs","repos_url":"https://api.github.com/users/spyder-issues-migrator/repos","events_url":"https://api.github.com/users/spyder-issues-migrator/events{/privacy}","received_events_url":"https://api.github.com/users/spyder-issues-migrator/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/1%20star","name":"1 star","color":"FFFFFF"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/done","name":"done","color":"FFFFFF"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/imported","name":"imported","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-16T23:21:09Z","updated_at":"2015-02-16T23:21:11Z","closed_at":null,"body":"_From [pybourgu...@gmail.com](https://code.google.com/u/113639270771538909286/) on 2009-11-07T11:18:37Z_\n\nI am using ctypes ( http://docs.python.org/library/ctypes.html ) in spyder.\r\nRestarting the python interpreter does not unload the libraries loaded\r\nusing ctypes. I am using Linux, Spyder version 1.0.1.\r\n\r\nA simple procedure to reproduce it is the following:\r\n1. Write a basic C file (single function that returns 1):\r\n   int one() { return 1 ; }\r\n2. Compile it with: gcc -shared -o one.so one.c\r\n3. In spyder's python interpreter, type:\r\n   from ctypes import *\r\n   libone = cdll.LoadLibrary(\"path to one.so\")\r\n   libone.one()\r\nThis will return 1\r\n4. Now modify the C file to return 2 instead of one, and recompile\r\n5. Restart the python interpreter and reproduce step 3: 1 is still returned.\r\n6. Relaunch spyder and reproduce step 3: 2 is returned.\n\n_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=107_"},"comment":{"url":"https://api.github.com/repos/spyder-ide/spyder/issues/comments/74588407","html_url":"https://github.com/spyder-ide/spyder/issues/107#issuecomment-74588407","issue_url":"https://api.github.com/repos/spyder-ide/spyder/issues/107","id":74588407,"user":{"login":"spyder-issues-migrator","id":11021581,"avatar_url":"https://avatars.githubusercontent.com/u/11021581?v=3","gravatar_id":"","url":"https://api.github.com/users/spyder-issues-migrator","html_url":"https://github.com/spyder-issues-migrator","followers_url":"https://api.github.com/users/spyder-issues-migrator/followers","following_url":"https://api.github.com/users/spyder-issues-migrator/following{/other_user}","gists_url":"https://api.github.com/users/spyder-issues-migrator/gists{/gist_id}","starred_url":"https://api.github.com/users/spyder-issues-migrator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spyder-issues-migrator/subscriptions","organizations_url":"https://api.github.com/users/spyder-issues-migrator/orgs","repos_url":"https://api.github.com/users/spyder-issues-migrator/repos","events_url":"https://api.github.com/users/spyder-issues-migrator/events{/privacy}","received_events_url":"https://api.github.com/users/spyder-issues-migrator/received_events","type":"User","site_admin":false},"created_at":"2015-02-16T23:21:10Z","updated_at":"2015-02-16T23:21:10Z","body":"_From [pierre.raybaut](https://code.google.com/u/pierre.raybaut/) on 2009-11-08T06:03:19Z_\n\nRestarting Python interpreter in Spyder does not reload modules -- note that\r\nreloading modules is not supported by the Python interpreter unless it is requested\r\nexplicitely with the 'reload' builtin function (and Interactive Console's 'restart\r\nPython interpreter' in Spyder does not really restart the Python interpreter because\r\nSpyder itself depends on it...).\r\n\r\nThe purpose of the 'Restart Python interpreter' feature is only to remove references\r\nto alive objects (and free memory) -- not to unload completely modules (.pyc will be\r\nloaded instead of .py -that's the way Python works- when re-importing modules after\r\nrestarting the interpreter).\r\n\r\nIn other words, what you should do to make it work is:\r\n    * step 3:\r\nimport ctypes\r\nlibone = ctypes.cdll.LoadLibrary(\"....\")\r\nlibone.one()\r\n    * step 5:\r\ninstead of 'restart python interpreter':\r\ndel libone\r\nreload(ctypes)\r\n\r\nI'm just guessing, this might not work.\r\n\r\nAnyway, as for issues related to reloading modules, please take a look at these: http://packages.python.org/spyder/console.html#reloading-modules https://code.google.com/p/spyderlib/issues/detail?id=62&can=1\n\n**Status:** Done  \n"}}