Skip to content

uuid.uuid1() fails on some machines (python bug) #1235

Closed
@erichiggins

Description

@erichiggins

plotly.py currently uses uuid.uuid1() to generate a trace UID. uuid1 relies on the MAC address of the machine's network interface for uniqueness, and on some machines in certain configurations, it can fail. It's certainly breaking for me on one of my machines.

This has been reported as an issue in core Python, but the fix has not been released to all versions.

Example & traceback

>>> import uuid
>>> uuid.uuid1()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/uuid.py", line 588, in uuid1
    clock_seq_hi_variant, clock_seq_low, node), version=1)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/uuid.py", line 164, in __init__
    raise ValueError('field 6 out of range (need a 48-bit value)')
ValueError: field 6 out of range (need a 48-bit value)

Suggested fix

Simply switching from uuid.uuid1 to uuid.uuid4 should maintain compatibility, uniquness, and avoid this issue as well as any privacy issues (as noted by the Python docs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions