Forums

PyMongo - Error

Hello guys,

i have a script wich will work throught a scheduled task.

I now face the problem, when i run the script two times within a short time period it will work the first time but the second time i run it i get this error:

pymongo.errors.ServerSelectionTimeoutError: No <class 'cryptography.x509.extensions.TLSFeature'> extension was found,No <class 'cryptography.x509.extensions.TLSFeature'> extension was found,No <class 'cryptog raphy.x509.extensions.TLSFeature'> extension was found, Timeout: 30s, Topology Description: <TopologyDescription id: 6691b36b997e6ebfade6271e, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-orsgag8-shard-00-00.t1swjlc.mongodb.net', 27017) server_type: Unknown, rtt: None, error=ExtensionNotFound("No <class 'cryptography.x509.extensions.TLSFeature'> extension was found")>, <ServerDescription ('ac-orsgag8-shard-00-01.t1swjlc.mongodb.net', 27017) server_type: Unknown, rtt: None, error=ExtensionNotFound("No <class 'cryptography.x509.extensions.TLSFeature'> extension was found")>, <ServerDescription ('ac-orsgag8-shard-00-02.t1swjlc.mongodb.net', 27017) server_type: Unknown, rtt: None, error=ExtensionNotFound("No <class 'cryptography.x509.extensions.TLSFeature'> extension was found")>]>

Im not sure and this is my first script that i create for this purpose. Maybe somebody can help me and tell me what im doing wrong.

Thanks!

If you're running that in the editor using the Run button, some libraries cannot be imported twice in the same Python process, so the second time you run it they will throw an error. You can kill the console between runs using ctrl-d and then it will work.

Thanks glenn! Didn't know that. Tried it already and everything worked fine!

Will i have this problem also if im running this script in a short period with a scheduled task?

For example: 1. Task -> 20:15 2. Task -> 20:20

No. The tasks should not affect each other.