nornir / dm4

A python file reader for Digital Micrograph's DM4 file format
MIT License
2 stars 2 forks source link

Added more complete example to README #4

Open volks73 opened 4 weeks ago

volks73 commented 4 weeks ago

Hello again! The link to the DM4 documentation was broken. It led to a "Page Not Found" at the domain. I believe I have found the same page at a new URL.

This also prompted me to update the README with a more complete example using the PyPI package.

This adds the example optional dependencies because the example uses dm4, numpy, and Pillow. It also updates the example code to use a context manager. I was getting the following error using the example code "as is" with Python v3.9 in a virtual environment:

Traceback (most recent call last):
  File "example_dm4.py", line 9, in <module>
    tags = dm4data.read_directory()
AttributeError: '_GeneratorContextManager' object has no attribute 'read_directory'

When I changed the example code to explicitly use the context manager and the with clause, the error was resolved.