This project has moved and is read-only. For the latest updates, please go here.

the Python Interactive windows of PTVS has a different result compared with Python Shell

Oct 17, 2013 at 4:00 PM
This is the image indicating the difference,though there is still an error,the Python Shell recognize the module "svmMLiA",Please help me and tell me why? thanks!
Oct 17, 2013 at 4:18 PM
The problem is the sys.path value. It look like we're starting the Interactive window with an incorrect directory, because its sys.path[0] is "C:\Windows\System32" (at least for me).

The actual shell has sys.path[0] == '', which means use the current directory.

You can fix this in two ways. One way is to type:
import sys
sys.path[0] = ''
import os
import svmMLiA
The other way is to add that path as a search path instead of changing to it (though depending on what it does, you may have to do the chdir for other reasons):
import sys
import svmMLiA
I'll file an issue so we fix the sys.path entry to be correct, but the second solution is more reliable. (Also, if you create a project with a script instead of the interactive window, you can do this automatically using search paths.)
Oct 17, 2013 at 4:19 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.