The Wayback Machine - https://web.archive.org/web/20200902201155/https://github.com/OSGeo/gdal/issues/2096
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

gdal2tiles --version crashes after printing version #2096

Open
daniel-j-h opened this issue Dec 11, 2019 · 1 comment
Open

gdal2tiles --version crashes after printing version #2096

daniel-j-h opened this issue Dec 11, 2019 · 1 comment

Comments

@daniel-j-h
Copy link

@daniel-j-h daniel-j-h commented Dec 11, 2019

See below; version 2.4.2 from the ubuntugis ppa.

Expected output is just the version information, no crash.

$ gdal2tiles.py --version
GDAL 2.4.2, released 2019/06/28
Traceback (most recent call last):
  File "/usr/bin/gdal2tiles.py", line 2927, in <module>
    main()
  File "/usr/bin/gdal2tiles.py", line 2917, in main
    input_file, output_folder, options = process_args(argv[1:])
TypeError: 'NoneType' object has no attribute '__getitem__'

Coming from

input_file, output_folder, options = process_args(argv[1:])
@kannes
Copy link
Contributor

@kannes kannes commented Dec 22, 2019

The cause is one line higher up, in

argv = gdal.GeneralCmdLineProcessor(sys.argv)
gdal.GeneralCmdLineProcessor returns None if you pass "--version". I have no idea what that function does and how it is supposed to work. There does not seem to be documentation for it.

Other bundled Python scripts https://github.com/OSGeo/gdal/search?q=GeneralCmdLineProcessor&unscoped_q=GeneralCmdLineProcessor check for None and abort, but they also do not use OptionParser. gdal2tiles.py is a totally foreign script, I would suggest simply dropping the version parameter to solve this. :}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.