I'm trying to run "import socket", and it fails. Why?
Here's the output from the console below:
Python 2.7.1 (release27-maint-npp, Feb 6 2011, 16:58:20)
Initialisation took 608ms
Ready.
>>> import socket
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "D:\p\Python27\Lib\socket.py", line 47, in <module>
import _socket
ImportError: DLL load failed: The specified module could not be found.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's because it's trying to load the _socket.pyd module from your existing Python installation. In order to avoid the MS VC Runtime dependency, the Python bundled with Python Script is compiled without the dependency, which unfortunately means that all the modules have to compiled that same way too. There are two options: 1) replace the python27.dll in the Notepad++ directory with your "official" python27.dll, or 2) alter the sys.path list to exclude the paths that relate to your existing installation. There's a script in this forum here - https://sourceforge.net/projects/npppythonscript/forums/forum/1188886/topic/4438530 - that fixes this exact issue.
A future version of Python Script will prepend the N++ specific paths, so that we don't have this problem, but it's not there yet.
Cheers,
Dave.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to run "import socket", and it fails. Why?
Here's the output from the console below:
Python 2.7.1 (release27-maint-npp, Feb 6 2011, 16:58:20)
Initialisation took 608ms
Ready.
>>> import socket
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "D:\p\Python27\Lib\socket.py", line 47, in <module>
import _socket
ImportError: DLL load failed: The specified module could not be found.
It's because it's trying to load the _socket.pyd module from your existing Python installation. In order to avoid the MS VC Runtime dependency, the Python bundled with Python Script is compiled without the dependency, which unfortunately means that all the modules have to compiled that same way too. There are two options: 1) replace the python27.dll in the Notepad++ directory with your "official" python27.dll, or 2) alter the sys.path list to exclude the paths that relate to your existing installation. There's a script in this forum here - https://sourceforge.net/projects/npppythonscript/forums/forum/1188886/topic/4438530 - that fixes this exact issue.
A future version of Python Script will prepend the N++ specific paths, so that we don't have this problem, but it's not there yet.
Cheers,
Dave.
Thanks for the detailed response! Greatly appreciated, Thanks.