httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.56k stars 3.67k forks source link

No such file or directory: '~/.config/httpie/version_info.json' #1388

Closed nico-arianto closed 2 years ago

nico-arianto commented 2 years ago

Checklist


Minimal reproduction code and steps

  1. do use http command, e.g. http GET http://localhost:8004/consumers/test

Current result

❯ http GET http://localhost:8004/consumers/test
HTTP/1.1 200 
Connection: keep-alive
Content-Length: 0
Date: Fri, 06 May 2022 06:28:00 GMT
Keep-Alive: timeout=60
X-B3-TraceId: baf0d94787afeb82

~ on ☁️  (ap-southeast-1) 
❯ Traceback (most recent call last):
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/__main__.py", line 19, in <module>
    sys.exit(main())
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/__main__.py", line 9, in main
    exit_status = main()
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/core.py", line 162, in main
    return raw_main(
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/core.py", line 44, in raw_main
    return run_daemon_task(env, args)
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/internal/daemon_runner.py", line 47, in run_daemon_task
    DAEMONIZED_TASKS[options.task_id](env)
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/internal/update_warnings.py", line 51, in _fetch_updates
    with open_with_lockfile(file, 'w') as stream:
  File "/opt/homebrew/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/utils.py", line 287, in open_with_lockfile
    with open(file, *args, **kwargs) as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/na/.config/httpie/version_info.json'

Expected result

❯ http GET http://localhost:8004/consumers/test
HTTP/1.1 200 
Connection: keep-alive
Content-Length: 0
Date: Fri, 06 May 2022 06:28:00 GMT
Keep-Alive: timeout=60
X-B3-TraceId: baf0d94787afeb82

(without the FileNotFoundError)


Debug output

Please re-run the command with --debug, then copy the entire command & output and paste both below:

❯ http --debug GET http://localhost:8004/consumers/test
HTTPie 3.2.0
Requests 2.27.1
Pygments 2.12.0
Python 3.10.4 (main, Apr 26 2022, 19:36:29) [Clang 13.1.6 (clang-1316.0.21.2)]
/opt/homebrew/Cellar/httpie/3.2.0/libexec/bin/python3.10
Darwin 21.4.0

<Environment {'apply_warnings_filter': <function Environment.apply_warnings_filter at 0x104179d80>,
 'args': Namespace(),
 'as_silent': <function Environment.as_silent at 0x104179c60>,
 'colors': 256,
 'config': {'default_options': []},
 'config_dir': PosixPath('/Users/nico.arianto/.config/httpie'),
 'devnull': <property object at 0x104153b00>,
 'is_windows': False,
 'log_error': <function Environment.log_error at 0x104179cf0>,
 'program_name': 'http',
 'quiet': 0,
 'rich_console': <functools.cached_property object at 0x104169570>,
 'rich_error_console': <functools.cached_property object at 0x10416b0a0>,
 'show_displays': True,
 'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
 'stderr_isatty': True,
 'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>,
 'stdin_encoding': 'utf-8',
 'stdin_isatty': True,
 'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>,
 'stdout_encoding': 'utf-8',
 'stdout_isatty': True}>

<PluginManager {'adapters': [],
 'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>,
          <class 'httpie.plugins.builtin.DigestAuthPlugin'>,
          <class 'httpie.plugins.builtin.BearerAuthPlugin'>],
 'converters': [],
 'formatters': [<class 'httpie.output.formatters.headers.HeadersFormatter'>,
                <class 'httpie.output.formatters.json.JSONFormatter'>,
                <class 'httpie.output.formatters.xml.XMLFormatter'>,
                <class 'httpie.output.formatters.colors.ColorFormatter'>]}>

>>> requests.request(**{'auth': None,
 'data': RequestJSONDataDict(),
 'headers': <HTTPHeadersDict('User-Agent': b'HTTPie/3.2.0')>,
 'method': 'get',
 'params': <generator object MultiValueOrderedDict.items at 0x104483220>,
 'url': 'http://localhost:8004/consumers/test'})

HTTP/1.1 200 
Connection: keep-alive
Content-Length: 0
Date: Fri, 06 May 2022 06:37:17 GMT
Keep-Alive: timeout=60
X-B3-TraceId: 5c2a368fd5b3f98a

~ on ☁️  (ap-southeast-1) 
❯ Traceback (most recent call last):
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/__main__.py", line 19, in <module>
    sys.exit(main())
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/__main__.py", line 9, in main
    exit_status = main()
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/core.py", line 162, in main
    return raw_main(
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/core.py", line 44, in raw_main
    return run_daemon_task(env, args)
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/internal/daemon_runner.py", line 47, in run_daemon_task
    DAEMONIZED_TASKS[options.task_id](env)
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/internal/update_warnings.py", line 51, in _fetch_updates
    with open_with_lockfile(file, 'w') as stream:
  File "/opt/homebrew/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/opt/homebrew/Cellar/httpie/3.2.0/libexec/lib/python3.10/site-packages/httpie/utils.py", line 287, in open_with_lockfile
    with open(file, *args, **kwargs) as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/nico.arianto/.config/httpie/version_info.json'

Additional information, screenshots, or code examples

Installation via homebrew

isidentical commented 2 years ago

Thanks for the report @nico-arianto, I've just release 3.2.1 with it. You can upgrade, and hopefully this would be resolved.

nico-arianto commented 2 years ago

@isidentical 👍🏼 Thanks for the quick fix, will try again after the 3.2.1 is available in the homebrew

nico-arianto commented 2 years ago

Fyi, tested and verified it fixed now.

Thanks again