smol-ai / developer

the first library to let you embed a developer agent in your own app!
https://twitter.com/SmolModels
MIT License
11.79k stars 1.03k forks source link

OSError: [Errno 30] Read-only file system: '/YOURFOLDER' #88

Open rn54n opened 1 year ago

rn54n commented 1 year ago

Hi,

when running modal run main.py --prompt prompt2.md- it creates a file inside generated folder shared_dependencies.md - fine. But after a few seconds it comes up with this error and it won't create the folders.

`main.py:191 in write_file 191 os.makedirs(dir, exist_ok=True)

:225 in makedirs` `OSError: [Errno 30] Read-only file system: '/YOURFOLDER'` I'm working using mac os x (M1) **What have I tried:** chmod a+x generated // no success Thank you upfront. Best
rn54n commented 1 year ago

I also tried to change the constants.py DEFAULT_DIR to "./generated" and also tried to add a custom directory while running modal with --directory /my/custom/directory

No success.

rn54n commented 1 year ago

Interesting after switching from gpt-3.5-turbo to gpt-4 in constants.py file it works!

ndepal commented 1 year ago

I'm also running into this issue:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/nick/src/smol-ai/developer/venv/bin/modal:8 in <module>                                   │
│                                                                                                  │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 8 │   sys.exit(main())                                                                         │
│   9                                                                                              │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/modal/__main__.py:6 in main   │
│                                                                                                  │
│    5 def main():                                                                                 │
│ ❱  6 │   entrypoint_cli()                                                                        │
│    7                                                                                             │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/click/core.py:1130 in         │
│ __call__                                                                                         │
│                                                                                                  │
│   1129 │   │   """Alias for :meth:`main`."""                                                     │
│ ❱ 1130 │   │   return self.main(*args, **kwargs)                                                 │
│   1131                                                                                           │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/typer/core.py:778 in main     │
│                                                                                                  │
│   777 │   ) -> Any:                                                                              │
│ ❱ 778 │   │   return _main(                                                                      │
│   779 │   │   │   self,                                                                          │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/typer/core.py:216 in _main    │
│                                                                                                  │
│   215 │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                       │
│ ❱ 216 │   │   │   │   rv = self.invoke(ctx)                                                      │
│   217 │   │   │   │   if not standalone_mode:                                                    │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/click/core.py:1657 in invoke  │
│                                                                                                  │
│   1656 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1658                                                                                           │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/click/core.py:1657 in invoke  │
│                                                                                                  │
│   1656 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1658                                                                                           │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/click/core.py:1404 in invoke  │
│                                                                                                  │
│   1403 │   │   if self.callback is not None:                                                     │
│ ❱ 1404 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                │
│   1405                                                                                           │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/click/core.py:760 in invoke   │
│                                                                                                  │
│    759 │   │   │   with ctx:                                                                     │
│ ❱  760 │   │   │   │   return __callback(*args, **kwargs)                                        │
│    761                                                                                           │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/click/decorators.py:26 in     │
│ new_func                                                                                         │
│                                                                                                  │
│    25 │   def new_func(*args, **kwargs):  # type: ignore                                         │
│ ❱  26 │   │   return f(get_current_context(), *args, **kwargs)                                   │
│    27                                                                                            │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/venv/lib/python3.9/site-packages/modal/cli/run.py:116 in f     │
│                                                                                                  │
│   115 │   │   │   else:                                                                          │
│ ❱ 116 │   │   │   │   func(*args, **kwargs)                                                      │
│   117 │   │   │   if app.function_invocations == 0:                                              │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/main.py:171 in main                                            │
│                                                                                                  │
│   170 │   │   │   ):                                                                             │
│ ❱ 171 │   │   │   │   write_file(filename, filecode, directory)                                  │
│   172                                                                                            │
│                                                                                                  │
│ /Users/nick/src/smol-ai/developer/main.py:191 in write_file                                      │
│                                                                                                  │
│   190 │                                                                                          │
│ ❱ 191 │   os.makedirs(dir, exist_ok=True)                                                        │
│   192                                                                                            │
│                                                                                                  │
│ /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os │
│ .py:215 in makedirs                                                                              │
│                                                                                                  │
│    214 │   │   try:                                                                              │
│ ❱  215 │   │   │   makedirs(head, exist_ok=exist_ok)                                             │
│    216 │   │   except FileExistsError:                                                           │
│                                                                                                  │
│ /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os │
│ .py:225 in makedirs                                                                              │
│                                                                                                  │
│    224 │   try:                                                                                  │
│ ❱  225 │   │   mkdir(name, mode)                                                                 │
│    226 │   except OSError:                                                                       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: [Errno 30] Read-only file system: '/path'

I suspect it has something to do with the output I see further up:

315 tokens in prompt:
    We have broken up the program into per-file g...
/path/to/python_script.py

I'm not sure how this works in conjunction with modal, but I only see what I assume are mounts where modal can write back into files on my machine:

✓ Created objects.
├── 🔨 Created generate_response.
├── 🔨 Created mount /Users/nick/src/smol-ai/developer/main.py
├── 🔨 Created mount /Users/nick/src/smol-ai/developer/utils.py
├── 🔨 Created mount /Users/nick/src/smol-ai/developer/constants.py
└── 🔨 Created generate_file.

By adding "the main part of the script should be in the file main.py" to the prompt, I was able to work around this error.

shooding commented 1 year ago

@ndepal "the main part of the script should be in the file main.py" works like magic !!