Script runs beautifully, but can't download modified files #29
Replies: 2 comments
-
Love the enthusiasm! I feel the same way. I think your problem can be broken down into two parts: 1) opening your html file 2) getting it to output the download link.
Here’s an example process that should work:
Note that GPT-4 is a bit better at generating the download link correctly. Generating the download link is “taught” one-shot in the internal prompt and GPT-3.5 doesn’t always follow that instruction. Feel free to re-open if this doesn’t work. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Right on, thanks Rick! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First, holy moly there is so much I want to use this for. Thank you.
Second, I get an error when I try to download a file from the UI. Here's the prompt and the response. Any help would be most appreciated.
Prompt: please strip html tags from this file
Response: I generated the following code:
from bs4 import BeautifulSoup
with open('filename.html') as file:
soup = BeautifulSoup(file, 'html.parser')
text = soup.get_text()
print download link if needed
print(f"Download file")
FileNotFoundError Traceback (most recent call last)
Cell In[4], line 3
1 from bs4 import BeautifulSoup
----> 3 with open('filename.html') as file:
4 soup = BeautifulSoup(file, 'html.parser')
5 text = soup.get_text()
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/IPython/core/interactiveshell.py:284, in _modified_open(file, *args, **kwargs)
277 if file in {0, 1, 2}:
278 raise ValueError(
279 f"IPython won't let you open fd={file} by default "
280 "as it is likely to crash IPython. If you know what you are doing, "
281 "you can use builtins' open."
282 )
--> 284 return io_open(file, *args, **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: 'filename.html'
Beta Was this translation helpful? Give feedback.
All reactions