Opened 6 years ago

Last modified 5 years ago

#3812 new defect

Specifying output in r.pack fails if you give a filename with no extension

Reported by: pmav99 Owned by: grass-dev@…
Priority: normal Milestone: 7.8.3
Component: Raster Version: unspecified
Keywords: Cc:
CPU: Unspecified Platform: Unspecified

Description

# This fails
$ r.pack input=elevation output=/tmp/packs/raster/elevation
Packing <elevation@PERMANENT> to </tmp/packs/raster/elevation>...
Traceback (most recent call last):
  File "/home/feanor/Prog/git/grass-p3/repo/dist.x86_64-pc-linux-gnu/scripts/r.pack", line 128, in <module>
    sys.exit(main())
  File "/home/feanor/Prog/git/grass-p3/repo/dist.x86_64-pc-linux-gnu/scripts/r.pack", line 112, in main
    tar = tarfile.TarFile.open(name=outfile_base, mode='w:gz')
  File "/usr/lib/python3.7/tarfile.py", line 1591, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/usr/lib/python3.7/tarfile.py", line 1638, in gzopen
    fileobj = gzip.GzipFile(name, mode + "b", compresslevel, fileobj)
  File "/usr/lib/python3.7/gzip.py", line 163, in __init__
    fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
IsADirectoryError: [Errno 21] Is a directory: 'elevation'

# This works...
$ r.pack input=elevation output=/tmp/packs/raster/elevation.pack
Packing <elevation@PERMANENT> to </tmp/packs/raster/elevation.pack>...

If an extension is expected, it should be documented. That being said the exception type is rather confusing.

For the record, v.pack does not raise this error.

Change History (1)

comment:1 by neteler, 5 years ago

Milestone: 7.8.3
Note: See TracTickets for help on using tickets.