developer resources
Codebales holds an ever growing number of solutions to problems that we have experienced in our day to day code writing
Selected filter
35
results
Andrew Fletcher
•
Maintaining a Drupal site is usually smooth sailing once the environment is properly set up. However, even in a stable environment, updates to modules can sometimes reveal underlying configuration issues that weren't apparent before. This was the case when I updated a contrib module on a Drupal 10.3 site, which suddenly started throwing errors related to the mbstring PHP extension.
The problem
The problem first surfaced after updating the search_api_attachments contrib module. The Drupal...
Andrew Fletcher
•
Managing dependencies in a web project can be challenging, especially when...
Andrew Fletcher
•
When attempting to install python libraries on my OSX
pip3 install pandas,...
Andrew Fletcher
•
The "Too many open files" error in Python typically occurs when your program has...
Andrew Fletcher
•
You can use the pip list --outdated command to view a list of installed Python...
Andrew Fletcher
•
Snapshot of the error
File "/opt/homebrew/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1271, in putheader
if _is_illegal_header_value(values[i]):The above error points to the putheader definition in client.py file located
python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/The putheader definition in the client.py file:
1250 def putheader(self, header, *values):
1251 """Send a...
Andrew Fletcher
•
To begin, note that Lando is often used for web development and it may not be...
Andrew Fletcher
•
Lando is a development environment tool that makes it easier to set up and...
Andrew Fletcher
•
The error message "RuntimeError: Directory 'static/' does not exist" typically...
Andrew Fletcher
•
It seems like you're using the CharacterTextSplitter class from the tiktoken...
Andrew Fletcher
•
To use OpenAI to summarise text from a PDF using Python 3.11.6, you'll first need to extract the text from the PDF and then send it to the OpenAI API for summarisation.
Preparation
Set-up
pip install python-dotenv langchain openai tiktoken pypdf pymupdf
Code
The current code is on my Summaries GitHub page.
Elements
Adjusting the parameters - you can adjust the max_tokens and temperature parameters in the summarize_with_openai function to control the length and...
Andrew Fletcher
•
The os.makedirs(directory_path) function in Python can be used with both...
Andrew Fletcher
•
You can move a file from one directory to another in Python using the shutil...
Andrew Fletcher
•
OpenAI request timeout?
Retrying...
Andrew Fletcher
•
Whilst installing Python 3.11.6 and running the command 'sudo make altinstall',...