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

scripts doesn't work directly on windows #9

Closed
JayXon opened this issue Feb 26, 2017 · 4 comments
Closed

scripts doesn't work directly on windows #9

JayXon opened this issue Feb 26, 2017 · 4 comments

Comments

@JayXon
Copy link
Contributor

JayXon commented Feb 26, 2017

λ hachoir-metadata
'hachoir-metadata' is not recognized as an internal or external command,
operable program or batch file.

but it's in PATH

λ which hachoir-metadata
/c/Users/JayXon/AppData/Local/Programs/Python/Python36/Scripts/hachoir-metadata

I have to do this:

λ python C:/Users/JayXon/AppData/Local/Programs/Python/Python36/Scripts/hachoir-metadata
Usage: hachoir-metadata [options] files

Options:
  -h, --help            show this help message and exit
  --type                Only display file type (description)
  --mime                Only display MIME type
  --level=LEVEL         Quantity of information to display from 1 to 9 (9 is
                        the maximum)
  --raw                 Raw output
  --bench               Run benchmark
  --force-parser=FORCE_PARSER
                        List all parsers then exit
  --parser-list         List all parsers then exit
  --profiler            Run profiler
  --version             Display version and exit
  --quality=QUALITY     Information quality (0.0=fastest, 1.0=best, and
                        default is 0.5)
  --maxlen=MAXLEN       Maximum string length in characters, 0 means unlimited
                        (default: 300)
  --verbose             Verbose mode
  --debug               Debug mode

I think the reason is that windows doesn't support #! in script, you might have to create a batch script for this to work.
For example a hachoir-metadata.bat file in the same directory with hachoir-metadata with something like this works for me.

@python %~dp0hachoir-metadata

Or a hachoir-metadata.bat file like this which doesn't need hachoir-metadata script.

@python -c __import__('hachoir.metadata.main').metadata.main.main()
@nneonneo
Copy link
Collaborator

nneonneo commented Feb 26, 2017 via email

@vstinner
Copy link
Owner

vstinner commented Feb 26, 2017 via email

@JayXon
Copy link
Contributor Author

JayXon commented Feb 26, 2017

python3 or python3.6 won't work, but since I only have python 3.6 installed, these 3 all works:
python -m hachoir.metadata
py -m hachoir.metadata
py -3 -m hachoir.metadata

Anyway, I did a little bit of research and it seems you should be using entry_points instead of scripts in setup.py, so that setuptools will handle cross-platform compatibility for you. I could come up with a PR if this sounds good to you.

@vstinner
Copy link
Owner

vstinner commented Feb 27, 2017 via email

JayXon added a commit to JayXon/hachoir3 that referenced this issue Feb 27, 2017
Fix vstinner#9
Also added missing xrc file for hachoir-wx
JayXon added a commit to JayXon/hachoir3 that referenced this issue Feb 28, 2017
Fixes scripts on Windows vstinner#9
Also added missing xrc file for hachoir-wx
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