Skip to content

nxid "underlying buffer has been detached" error with check_ezid #26

Open
@ngeraci

Description

@ngeraci

When I run nxid in a Python 3 environment on an item that already has an ARK, I'm getting the following error:
(Expected output is ℹ noop update)

  File "/home/noah/miniconda3/bin/nxid", line 10, in <module>
    sys.exit(main())
  File "/home/noah/miniconda3/lib/python3.7/site-packages/pynux/nxid.py", line 155, in main
    print('ℹ noop update "{}" {} {}'.format(path, ark, owner))
ValueError: underlying buffer has been detached
Exception ignored in: <_io.TextIOWrapper mode='w' encoding='UTF-8'>
ValueError: underlying buffer has been detached

It looks like this may have to do with the stdout stuff in the check_ezid function that gets called if ARK is not none:

pynux/pynux/nxid.py

Lines 167 to 175 in 92f813f

def check_ezid(ark, ezid):
''' check to see if the ARK is listed in EZID, returns raw ERC or `None`'''
try:
sys.stdout = open(os.devnull, 'w')
return ezid.view(ark)
except HTTPError:
return None
finally:
sys.stdout = sys.__stdout__

This doesn't affect the ability to mint new ARKs for items with no ARK, which is my main day to day use case, so it's not a big priority on my end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions