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

Not noticing zip import failed causes later workflow problems #13

Open
jeremydouglass opened this issue Jul 29, 2018 · 1 comment
Open

Comments

@jeremydouglass
Copy link
Collaborator

From @scottkleinman:

Common Errors in Notebooks 1 and 2

You have supplied an incorrect path to the zip files containing your data. It is possible not to notice the error message until you run Notebook 2. A good practice is to check whether there are files in your caches/json folder. If not, the import has failed, and you should go back and check the path(s) you supplied in Notebook 1.

If Notebook 2 still doesn't run, check whether there are any files in your caches/text_files and caches/text_files folders. This will help you determine what stage in the workflow is encountering an error.

@jeremydouglass
Copy link
Collaborator Author

I have an idea for patching the zip import cell -- something like this:

from IPython.core.display import display, HTML

!mkdir -p caches/json
unzipped = []
errors = []
for datafile in datafile_list:
    datapath = jsondatadir + datafile
    result = !unzip -j -o -u {datapath} -d caches/json
    result_str = '\n'.join(result)
    if 'unzip:' in result_str:
        errors.append(result_str)
    else:
        unzipped.append(result_str)

if unzipped:
    for event in unzipped:
        print(event)

if errors:
    display(HTML('<h1>ERRORS</h1>'))
    for error in errors:
        display(HTML('<strong>Error:</strong>'))
        print(error)

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

No branches or pull requests

1 participant