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

'arcee configure' doesn't create parent directories #78

Open
juliensimon opened this issue Jul 25, 2024 · 0 comments
Open

'arcee configure' doesn't create parent directories #78

juliensimon opened this issue Jul 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@juliensimon
Copy link
Contributor

arcee configure doesn't create the parent directories for the config.json file if they're missing.

Example:

arcee configure
Current API URL: https://app.arcee.ai/api
API key: not in config (file or env)

Enter your Arcee API key 🔒
Hit enter to leave it as is.
See https://docs.arcee.ai/getting-arcee-api-key/getting-arcee-api-key for more details.
You can also pass this at runtime with the ARCEE_API_KEY environment variable.
: <MY_API_KEY>
Setting API key
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/julien/Development/env-arcee-cloud/lib/python3.12/site-packages/arcee/cli/app.py:103 in   │
│ configure                                                                                        │
│                                                                                                  │
│   100 │   │   )                                                                                  │
│   101 │   │   if resp:                                                                           │
│   102 │   │   │   console.print("Setting API key")                                               │
│ ❱ 103 │   │   │   write_configuration_value("ARCEE_API_KEY", resp)                               │
│   104                                                                                            │
│   105                                                                                            │
│   106 # Enter the CLI                                                                            │
│                                                                                                  │
│ /Users/julien/Development/env-arcee-cloud/lib/python3.12/site-packages/arcee/config.py:42 in     │
│ write_configuration_value                                                                        │
│                                                                                                  │
import json
│   39 │   │   │   except json.JSONDecodeError:                                                    │
│   40 │   │   │   │   pass                                                                        │
│   41 │   else:                                                                                   │
│ ❱ 42 │   │   conf_path.touch()                                                                   │
│   43 │                                                                                           │
│   44 │   config[key] = value                                                                     │
│   45                                                                                             │
│                                                                                                  │
│ /opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12 │
│ /pathlib.py:1303 in touch                                                                        │
│                                                                                                  │
│   1300 │   │   flags = os.O_CREAT | os.O_WRONLY                                                  │
│   1301 │   │   if not exist_ok:                                                                  │
│   1302 │   │   │   flags |= os.O_EXCL                                                            │
│ ❱ 1303 │   │   fd = os.open(self, flags, mode)                                                   │
│   1304 │   │   os.close(fd)                                                                      │
│   1305 │                                                                                         │
│   1306 │   def mkdir(self, mode=0o777, parents=False, exist_ok=False):                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: '/Users/julien/Library/Application Support/arcee/config.json'

Indeed, the arcee directory doesn't exist on my machine.

I have a one-line fix. PR on the way :)

juliensimon pushed a commit to juliensimon/arcee-python that referenced this issue Jul 25, 2024
@juliensimon juliensimon added the bug Something isn't working label Jul 25, 2024
nason added a commit that referenced this issue Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant