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

Define behaviour for missing filenames #60

Open
dwysocki opened this issue Feb 20, 2015 · 1 comment
Open

Define behaviour for missing filenames #60

dwysocki opened this issue Feb 20, 2015 · 1 comment
Labels

Comments

@dwysocki
Copy link
Member

Some headache inducing behaviour I encountered today.

If you give plotypus a list of photometry file names from stdin, and one of those doesn't actually exist, it will give a cryptic error message like the following:

Traceback (most recent call last):
  File "/home/dwysocki/.local/bin/plotypus", line 9, in <module>
    load_entry_point('plotypus==0.2.6-dev', 'console_scripts', 'plotypus')()
  File "/home/dwysocki/plotypus/src/plotypus/plotypus.py", line 283, in main
    processes=args.star_processes, **picklable_args)
  File "/home/dwysocki/plotypus/src/plotypus/utils.py", line 84, in pmap
    for arg in args]
  File "/home/dwysocki/plotypus/src/plotypus/utils.py", line 83, in <listcomp>
    results = [p.apply_async(func, (arg,), kwargs, callback)
  File "/home/dwysocki/plotypus/src/plotypus/plotypus.py", line 251, in <lambda>
    else path.join(args.input, filename),
  File "/home/dwysocki/.local/lib/python3.3/posixpath.py", line 83, in join
    path += b
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

I encountered this while trying to run plotypus on the OGLE-III LMC cepheids, by taking the names from the cepF.dat file they provided, and adding the appropriate directory and file extension information. Turns out, some of the names in that file do not actually have photometry for whatever reason, causing it to crash with the above error.

I see pros and cons to skipping non-existant filenames. On one hand, it makes problems like this trivial, and a verbose error message could be produced. On the other hand, it does make things more error prone. Either way, we should provide a better error message.

For now I'll just have to use some sort of UNIX wizardry to get around this problem.

@dwysocki dwysocki added this to the Engineering goals milestone Feb 20, 2015
@dwysocki
Copy link
Member Author

For what it's worth, here is the UNIX wizardry that got me around the problem.

ls -d -1 phot/I/* |         # list all file names in  phot/I/ directory, including their relative paths
comm -1 -2 cepF-names.dat - # suppress all file names not present in *both* the directory and the names file

It was simple enough, so perhaps an improved error message is all we need.

@dwysocki dwysocki added the bug label Aug 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant