Frequent connection issues with event daemon: [Errno 9] Bad file descriptor

Hi,

I have an event daemon running on windows and am ferquently getting errors when my api is trying to connect to SG in my custom ShotGun module like this:

        sg = shotgun_api3.Shotgun(self.SERVER_PATH,
                                                         self.SCRIPT_NAME,
                                                         self.SCRIPT_KEY,
                                                         ca_certs=ca_certs_path)
    except Exception as e:
        raise IOError("Unable to connect to Shotgun server. " + str(e))

The erorr I am getting via the daemon is:

IOError: Unable to connect to Shotgun server. [Errno 9] Bad file descriptor

I am a bit vconfused about this one as I didn’t think an attempted SG connection coudl cause a bad file descriptor error?! Could this be something triggered from within the damone framework?
This is the full traceback:

Traceback (most recent call last):
  File "D:\pipeline\tools\python\shotgun_events\src\shotgunEventDaemon.py", line 970, in process
    self._callback(self._shotgun, self._logger, event, self._args)
  File "d:/pipeline/tools/python/shotgun_events/plugins\checkVersionDuration.py", line 64, in check_version_duration
    SGR = ShotGun.SG_Read()
  File "d:\pipeline\tools\python\ShotGun.py", line 146, in __init__
    raise IOError("Unable to connect to Shotgun server. " + str(e))
IOError: Unable to connect to Shotgun server. [Errno 9] Bad file descriptor

This has been haunting me forever, does anybody have an idea what might be causing this?

Cheers,
frank

There must be a way to get more information. Instead of IOError(...str(e)) do

import traceback
...
except Exception as e:
  print(traceback.format_exc())

(without passing e inside as argument)
This will give you the actual traceback where it failed.
Are you sure the ca_certs_path is correct?

Will do right now and see if I get anything in the morning, thanks.

Yes, ca_certs_path is correct. I use this SG instance all the time in all my pipeline code, and only if it’s called from the windows machine’s event daemon does it occur, and even then only sporadically.

I will report back if I find out more.

Cheers,
frank