dsoprea/go-exif

throw panic "no such file or directory" even if file exist

Dentrax opened this issue · 3 comments

Hey, thanks for the cool project!

I have a test.gif file in the current directory. Running the following command, throws panic error:

$ exif-read-tool -filepath test.gif
*fs.PathError open ilepath: no such file or directory
/Users/furkan.turkal/go/pkg/mod/github.com/dsoprea/go-exif/v3@v3.0.0-20210512055020-8213cfabc61b/command/exif-read-tool/main.go:92 (0x11cb177)
	main: log.PanicIf(err)
/usr/local/go/src/runtime/proc.go:225 (0x1037516)
	main: fn()
/usr/local/go/src/runtime/asm_amd64.s:1371 (0x1067c21)
	goexit: BYTE	$0x90	// NOP
$ open test.gif  # this OK

Any ideas? 🤔

That error message concerns me: "ilepath".

Wow, you are right! I just noticed that, in the README, you used -filepath, instead of --filepath. Two-dashed flags seems to work!

That was my first assumption, but it still doesn't explain why you got that specific error message. For example, if you provide -filepath then, sure, ilepath might be taken as the filename. However, there'd still be an error for you passing an extra argument. But, that didn't happen.

Both of these result in the same error:

$ go run command/exif-read-tool/main.go -filepath 
Stack:

*fs.PathError open ilepath: no such file or directory
/home/dustin/go/src/github.com/dsoprea/go-exif/v3/command/exif-read-tool/main.go:92 (0x5cb7f7)
    main: log.PanicIf(err)
/usr/local/go/src/runtime/proc.go:225 (0x437cb6)
    main: fn()
/usr/local/go/src/runtime/asm_amd64.s:1371 (0x468041)
    goexit: BYTE    $0x90   // NOP

exit status 254

$ go run command/exif-read-tool/main.go -filepath assets/gps.jpg
Stack:

*fs.PathError open ilepath: no such file or directory
/home/dustin/go/src/github.com/dsoprea/go-exif/v3/command/exif-read-tool/main.go:92 (0x5cb7f7)
    main: log.PanicIf(err)
/usr/local/go/src/runtime/proc.go:225 (0x437cb6)
    main: fn()
/usr/local/go/src/runtime/asm_amd64.s:1371 (0x468041)
    goexit: BYTE    $0x90   // NOP