SpecklePy get_default_account() error

Just trying the example script from https://speckle.guide/dev/py-examples.html#sending-receiving, and receiving an error on running account = get_default_account():

Error queueing metrics request: [Errno 8] nodename nor servname provided, or not known

Seems to be from: specklepy/logging/metrics.py, line 117, in __init__ self.user_ip = socket.gethostbyname(socket.gethostname())
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Any ideas?

Have you installed accounts on your machine with Speckle Manager?

Yep, at https://speckle.xyz

hey @daniel-fink!

thanks a lot for reporting - and welcome to the forum! feel free to Introduce yourself :person_gesturing_ok: if youā€™d like.

this is unexpected behaviour as metrics shouldnā€™t be throwing errors - may I ask what OS / environment youā€™re using as I havenā€™t encountered this before?

either way, that attribute throwing the error isnā€™t used by our metrics anymore so Iā€™ve dropped it and released v2.7.1 of specklepy which should resolve this issue for you! let me know if you run into any other issues getting started.

BTW I am on macOS 11.6.6 (20G624), if that has any bearing? Some of my minor internet sleuthing turns up a few issues re: socket and /etc/hosts, but I canā€™t seem to fix it via those suggestions.

Iā€™m also using poetry for package management & venv

interesting! i havenā€™t done a lot of testing on mac yet (new mac user here!) but will have a look as well.

upgrading to specklepy 2.7.1 should resolve this issue, but please feel free to report back if anything else crops up

to clarify, were you still able to run the script or did the script actually throw and stop execution at this point? in theory, errors in metrics should only be logging warnings / errors to the console but shouldnā€™t actually be throwing and halting execution. if it is throwing though, Iā€™ll have to investigate to find a fix hereā€¦

1 Like

Thanks. This all works.
Re: errors, I believe it raised an Exception and stopped execution

It appears to be a potential issue in the Python code. To address it, you should ensure that both the hostname and IPv4 settings are properly configured. Once you have completed this step, you can proceed with resolving the problem.

import socket
hostname = socket.gethostname()
print(hostname)  >> testsystem

# make sure do it
!echo "127.0.0.1 testsystem" >> /private/etc/hosts
1 Like