developer icon indicating copy to clipboard operation
developer copied to clipboard

Not working without Modal

Open localjo opened this issue 1 year ago • 2 comments

I tried the instructions without Modal:

python main_no_modal.py "A basic React app that just displays a page that says 'Hello, World!'"

Result:

Traceback (most recent call last):
  File "/Users/dzso/Dev/smol-dev/main_no_modal.py", line 245, in <module>
    main(prompt, directory, file)
NameError: name 'file' is not defined. Did you mean: 'filter'?

Seems like the it's expecting another arg for file, but I'm not sure what to give it. I tried by giving it one more argument, test.js, but I get the same error.

localjo avatar May 17 '23 09:05 localjo

I got a little farther by adding file = None to the beginning of the block on line 235, changing line 125 to filepaths_string = generate_response( instead of filepaths_string = generate_response.call( and setting openai_model = "gpt-3.5-turbo". I also had to manually define my env vars (the .env file wasn't read).

Now, when I run the command it seems like the prompts are executed and something is generated, but it still crashes with the following error:

Traceback (most recent call last):
  File "/Users/dzso/Dev/smol-dev/main_no_modal.py", line 246, in <module>
    main(prompt, directory, file)
  File "/Users/dzso/Dev/smol-dev/main_no_modal.py", line 189, in main
    write_file(filename, filecode, directory)
  File "/Users/dzso/Dev/smol-dev/main_no_modal.py", line 207, in write_file
    file.write(filecode)
TypeError: write() argument must be str, not tuple

localjo avatar May 17 '23 10:05 localjo

Replacing line 207 with: file.write(filecode[1])

makes it work

gonzab avatar May 17 '23 17:05 gonzab

I believe I've fixed these issues in PR #17, if you'd like to give it a shot!

thatliuser avatar May 17 '23 20:05 thatliuser

thanks to @thatliuser i think this is solved, pls reopen otherwise!

swyxio avatar May 18 '23 00:05 swyxio