I’ve promised myself fewer rabbit hole adventures this year, so I’ll just ask…
I’ve not touched python for a few years and was just dusting it off for new years eve playtime and hit an immediate roadblock. It doesn’t seem likely that default server isn’t accessible from specklepy so am I missing something super basic? Environment variables?
# the speckle.objects module exposes all speckle provided classes
from specklepy.api.client import SpeckleClient
from specklepy.api.credentials import get_local_accounts, get_default_account
class Reader(object):
def __init__(self):
# initialise the client
client = SpeckleClient(host="speckle.xyz",use_ssl=True) # default is xyz
and …
Python Exception <SpeckleException>: SpeckleException: https://speckle.xyz is not a compatible Speckle Server
Python Exception <SpeckleException>: SpeckleException: https://speckle.xyz is not a compatible Speckle Server
Traceback (most recent call last):
File "…/specklepy/api/client.py", line 81, in __init__
raise Exception("Couldn't get ServerInfo")
Exception: Couldn't get ServerInfo
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 37, in input
File "…/specklepy/api/client.py", line 83, in __init__
raise SpeckleException(f"{self.url} is not a compatible Speckle Server", ex)
specklepy.logging.exceptions.SpeckleException: SpeckleException: https://speckle.xyz is not a compatible Speckle Server
This may not be a speckle question. I have successfully written a more featured script beyond simply authenticating. This is running on the base installation of python on my machine.
It is running this script within the PythonCaller environments of FME that is raising the error, so I’ll raise it with them to see what might be at the root.
It also works with the FME python REPL, so I’m looking into whether certain transports are possible from the PythonCreator/PythonCaller transformers.
Hmm, looks like there is an error making an initial graphql request to check the server.
The error handling could be improved to show what actually happened, but until we do that, could you run the following code to see the details of what went wrong doing the graphql request?
from specklepy.api.client import SpeckleClient
obj = object.__new__(SpeckleClient)
try:
obj.__init__()
except Exception as ex:
print('the error happened, ignoring')
print(obj.server.get())
I looked a bit into this and my guess is that it’s related to missing HTTPS certificates in the PyhtonCaller environment ( in their forum they recommend to ignore certificates completely: FME Community )
I’ll ping @izzylys for thoughts about this, most probably we will have to do in-depth testing on PythonCaller environment to have basic support for it (even if it means ignoring https certificates?)
Much appreciated @cristi (& @izzylys) In fact, I’m happy to make the looking into this and liaise with the FME people.
My first post motivation was to not do any unnecessary digging in case it was a simple problem I was missing. So often I get sucked into impossible missions having stumbled onto edge cases due to something dumb.
One more thought about this, to check if it’s related to urllib3 / requests version incompatibilities with gql library.
Can you run this to check if it has any errors? (on success, it should output the 200 status code and the server version in a json, currently at 2.3.6)
Curiously, the urllib3 installed within FME is as latest so the class signature should allow that keyword.
UPDATE
I’m already into working out the runtime dependency loading of FME as the urllib library in the plugins folder is 1.26.7, but at runtime, the version is 1.25.7 hence the missing signature.