GoldenEye: Source Forums

Debriefing => Bug Reports & Fixes => Topic started by: Phivex on September 19, 2016, 01:19:41 am

Title: [ISSUE] [Solved] ImportError: No module named '_socket'
Post by: Phivex on September 19, 2016, 01:19:41 am
The error " ImportError: No module named '_socket' " is raised and the game crashes after creating a server whenever I import "from logging.handlers import RotatingFileHandler" into "...\GamePlay\__inti__.py" It doesn't mind when I use "import logging", but it doesn't like the RotatingFileHandler class.

Below is the error in the python.log. Anything I can do to fix it? I can import both the RotatingFileHandler and _socket with my own version of Python (2.7.12), so I imagine it's maybe using an older version of Python from before the current implementation of the RotatingFileHandler class?

Code: [Select]
Traceback (most recent call last):
  File "c:\program files (x86)\steam\steamapps\sourcemods\gesource\python/ges\GESInit.py", line 43, in LoadManager
    __import__( name, globals(), locals() )
  File "c:\program files (x86)\steam\steamapps\sourcemods\gesource\python/ges\GamePlayManager.py", line 23, in <module>
    import GamePlay
  File "c:\program files (x86)\steam\steamapps\sourcemods\gesource\python/ges\GamePlay\__init__.py", line 27, in <module>
    from logging.handlers import RotatingFileHandler
  File "c:\program files (x86)\steam\steamapps\sourcemods\gesource\python/lib\logging\handlers.py", line 26, in <module>
    import logging, socket, os, pickle, struct, time, re
  File "c:\program files (x86)\steam\steamapps\sourcemods\gesource\python/lib\socket.py", line 47, in <module>
    import _socket
ImportError: No module named '_socket'
Title: Re: [ISSUE] ImportError: No module named '_socket'
Post by: killermonkey on September 19, 2016, 02:36:14 am
Sockets are not supported in our build of Python for security reasons.
Title: Re: [ISSUE] [Solved] ImportError: No module named '_socket'
Post by: Phivex on September 19, 2016, 09:42:05 am
Ah. Okay. That makes sense then. Thanks for taking cyber security into consideration. It's too often thrown to the wayside for convenience.

I was hoping to use the module so I wouldn't have to worry about a file getting to large when collecting stats. Now I'll probably just tell the program to clean the file at startup each time. I was just hoping to avoid that since it would decrease portability having more code in multiple places.
Title: Re: [ISSUE] [Solved] ImportError: No module named '_socket'
Post by: killermonkey on September 20, 2016, 01:43:29 am
hmmmmm, after looking into this it looks like we should probably include socket... I think it breaks a lot more modules then I anticipated...