This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: FileNotFoundError: [Errno 2] No such file or directory:
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Tester, steven.daprano, xtreak
Priority: normal Keywords:

Created on 2018-10-28 00:06 by Tester, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg328666 - (view) Author: TestUser (Tester) Date: 2018-10-28 00:06
Seems the base64 module has issues with bad file(s). This does not seems to generate a Crash Report.

t:~$ python3 -m base64 -d "12s345a2"
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.6/base64.py", line 602, in <module>
    main()
  File "/usr/lib/python3.6/base64.py", line 585, in main
    with open(args[0], 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '12s345a2'

test@TestNut:~$ python3 -m base64 -d /test.txt
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.6/base64.py", line 602, in <module>
    main()
  File "/usr/lib/python3.6/base64.py", line 585, in main
    with open(args[0], 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/test.txt'
msg328668 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2018-10-28 00:39
What do you mean, a crash report?

You get a traceback telling you the problem: the file is missing. What behaviour did you expect if you try to decode a non-existent file?

Perhaps you meant to write:

python3 -m base64 -t "12s345a2"

I don't think this is a bug, I think it is working correctly. If you cannot explain why it is a bug, we'll close this bug report.
msg328677 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-10-28 05:48
I can see one another related report issue35084. As @steven.daprano said this is an expected traceback and it's working correctly. -d expects a valid base64 encoded file and supplying a non-existent file or file with invalid encoding is supposed to throw a traceback.
msg328734 - (view) Author: TestUser (Tester) Date: 2018-10-28 20:03
How can that be CLI useful. Lucky I guess as this does not generate a Crash
Report. OK.

Bad/Missing File would have been my preferred. Then again?

Thanks

On Sun, Oct 28, 2018 at 1:48 AM Karthikeyan Singaravelan <
report@bugs.python.org> wrote:

>
> Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment:
>
> I can see one another related report issue35084. As @steven.daprano said
> this is an expected traceback and it's working correctly. -d expects a
> valid base64 encoded file and supplying a non-existent file or file with
> invalid encoding is supposed to throw a traceback.
>
> ----------
> nosy: +xtreak
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35085>
> _______________________________________
>
History
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79266
2018-10-28 22:21:09steven.dapranosetstatus: open -> closed
resolution: not a bug
stage: resolved
2018-10-28 20:03:10Testersetmessages: + msg328734
2018-10-28 05:48:50xtreaksetnosy: + xtreak
messages: + msg328677
2018-10-28 00:39:32steven.dapranosetnosy: + steven.daprano
messages: + msg328668
2018-10-28 00:06:56Testercreate