Skip to content

Added more complete example to README#4

Open
volks73 wants to merge 2 commits intonornir:masterfrom
Theia-Scientific:master
Open

Added more complete example to README#4
volks73 wants to merge 2 commits intonornir:masterfrom
Theia-Scientific:master

Conversation

@volks73
Copy link

@volks73 volks73 commented Jun 8, 2024

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.

volks73 and others added 2 commits June 8, 2024 09:45
* Fix punctuation

* Fix broken link

* Add Pillow for test dependency

This is for the README's example code, which uses Pillow/PIL to save a
TIFF file of the image data from a DM4 file.

* Add optional example dependencies

* Add more complete example

* Change to code block

This should enable syntax highlighting.

* Fix code block syntax

* Remove code block

GitHub RST support is broken.

---------

Co-authored-by: Christopher Field <chris.field@theiascientific.com>
Co-authored-by: Christopher Field <chris.field@theiascientific.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant