You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
platform.node() does not return the latest hostname value #122525
importplatform, socketprint(platform.node(), socket.gethostname())
# update the machine's hostname (for macOS it's Settings -> General -> Sharing)print(platform.node(), socket.gethostname()) # notice that this is reporting the old value
Oh I hadn’t noticed that there’s a platform.uname() method as well. I guess this is somewhat intentional then. It would help to document that uname and its dependents rely on a cached result that might be knowingly stale.
Most of the functions in platform are using cached values. However, I somewhat think that we should have a mean to invalidate this cache. I'll prepare a PR for that.
Activity
kashav commentedon Jul 31, 2024
STR in case they help:
ZeroIntensity commentedon Jul 31, 2024
I'm guessing this is somewhat intentional.
platform.node()is equivalentplatform.uname().node, anduname()has a cached result.kashav commentedon Jul 31, 2024
Oh I hadn’t noticed that there’s a
platform.uname()method as well. I guess this is somewhat intentional then. It would help to document thatunameand its dependents rely on a cached result that might be knowingly stale.picnixz commentedon Aug 1, 2024
Most of the functions in
platformare using cached values. However, I somewhat think that we should have a mean to invalidate this cache. I'll prepare a PR for that.