Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
erichiggins opened this issue Oct 22, 2018 · 2 comments
Closed

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

erichiggins opened this issue Oct 22, 2018 · 2 comments
Labels
bug something broken
Milestone

Comments

@erichiggins
Copy link
Contributor

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).

@jonmmease jonmmease added the bug something broken label Oct 22, 2018
@jonmmease jonmmease added this to the v3.4.0 milestone Oct 22, 2018
@jonmmease
Copy link
Contributor

Hi @erichiggins, thanks for the report and background research. Yes, uuid4 looks like a good solution.

@jonmmease
Copy link
Contributor

Done in #1236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants