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

h5topng error: invalid colormap file #16

Closed
Andeloth opened this issue Feb 28, 2022 · 7 comments
Closed

h5topng error: invalid colormap file #16

Andeloth opened this issue Feb 28, 2022 · 7 comments

Comments

@Andeloth
Copy link

Getting this error when I try to use h5topng

(mp) login04% h5topng -v <filename>              
Using colormap "gray" in file "~/miniconda3/envs/mp/share/h5utils/colormaps/".
h5topng error: invalid colormap file

I just cloned the repo and replaced the old files in the directory with new ones but that didn't fix it.

@linogg
Copy link

linogg commented Jan 13, 2023

Hey, I also still get this same problem. Just trying to follow the meep bent-waveguide tutorial line by line but I run into "h5topng errror: invalid colormap file". Tried it on fresh conda-forge installs on differnt machines, both in WSL and on Linux.
Tried the fixes on all other instances of this problem I could find online. Anyone has an idea? Help greatly appreciated :)

@stevengj
Copy link
Collaborator

stevengj commented Jan 13, 2023

What are the contents of ~/miniconda3/envs/mp/share/h5utils/colormaps/gray? It should be the same as https://github.com/NanoComp/h5utils/blob/master/colormaps/gray

@smartalecH or @mochen4, can you reproduce this?

@Andeloth
Copy link
Author

I've experienced this with every colormap I've tried (I tried like 4-5) and they all give the same result. Our research group hasn't been able to use h5topng and other colormap dependent commands for over a year now.

My file matches the one you linked as well.

@linogg
Copy link

linogg commented Jan 14, 2023

What are the contents of ~/miniconda3/envs/mp/share/h5utils/colormaps/gray? It should be the same as https://github.com/NanoComp/h5utils/blob/master/colormaps/gray

Yes, its the same. Have also tried different colormaps, same problem.

@stevengj
Copy link
Collaborator

stevengj commented Jan 15, 2023

Hmm, I suspect that the problem is the tilde in "~/miniconda3/envs/mp/share/h5utils/colormaps/"~ is a shell metacharacter, and doesn't generally work in non-shell programs like the fopen function in an arbitrary C program.

I'm not sure what the Conda build is doing to get the tilde into the path? But it might be doing that in an incorrect attempt to try to make the paths relocatable…

The simplest solution might be to update h5topng.c to do tilde expansion: https://stackoverflow.com/questions/15991241/how-do-i-achieve-tilde-expansion-in-c

@stevengj
Copy link
Collaborator

stevengj commented Jan 15, 2023

Oh, it is probably putting a ~ in the datadir, which we include in the code without doing tilde expansion:

AC_DEFINE_UNQUOTED(DATADIR, "$datadir_val", [datadir installation prefix])

@stevengj
Copy link
Collaborator

stevengj commented Jan 15, 2023

Hopefully should be fixed by bfaac9c, which is in the new 1.13.2 release, once conda updates their binaries.

In the meantime the workaround is to specify the colormap path manually with h5topng -c ~/miniconda3/envs/mp/share/h5utils/colormaps/gray.

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

3 participants