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

write_output doesn't work #54

Closed
ianmilligan1 opened this Issue Apr 23, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@ianmilligan1
Copy link
Member

commented Apr 23, 2019

As part of #44 I was re-working the file outputs, and we discovered that the file outputs don't work.

Here's the write_output function from au_notebook [repo]

    def write_output(self, stdout, results):
        """ Writes results to file.
        :param stdout: Filepath for file.
        :param results: A list of results.
        :return: None.
        """
        try:
            with open(filename, "w") as output:
                for value in results:
                    output_file_write(str(value))
        except:
            print("Error writing the file.")

When it's called, you get

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-24-be93de9f0824> in <module>()
----> 1 au_notebook.write_output('./filtered-by-year.txt', year_results)

TypeError: write_output() missing 1 required positional argument: 'results'

As part of the fix, it'd be great if something like this would work out of the box:

au_notebook.write_output('./filtered-by-year.txt', year_results)
@ruebot

This comment has been minimized.

Copy link
Member

commented Apr 23, 2019

Tested on my end, and changed it to the missing import prefix nb.write_output(filename, year_results). It results in the error message in the function: Error writing the file.

@greebie

This comment has been minimized.

Copy link
Collaborator

commented Apr 24, 2019

Once completed there will be a small PR here as well to switch to nb.write_output().

ruebot added a commit to archivesunleashed/au_notebook that referenced this issue Apr 24, 2019

@ruebot

This comment has been minimized.

Copy link
Member

commented Apr 24, 2019

au_notebook-0.0.3 cut: https://pypi.org/project/au-notebook/

@greebie make sure you update requirements.txt, and the README when you do this PR.

ianmilligan1 added a commit that referenced this issue Apr 25, 2019

Add class call to write_output(). #54 (#55)
* Add class call to write_output().

* update README.md
@ianmilligan1

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2019

Closed with 256db8e (#55)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.