How to Return JSON Encoded Response for a non-dict object
In DJango, an HttpResponse sub-class helps to create a JSON-encoded response. It was called Serialized-Object response in Django < 1.7. Its default Content-Type header is set to application/JSON. The first parameter (data set), should be a dict instance. If non-dict object is passed in as the first parameter, a TypeError will be raised. To fix this error, we just need to add a parameter called “safe” to False in the method call JsonResponse. TypeError: In order to allow non-dict objects to be serialized set the…
Django errors while working with components
1) OperationalError at /admin/csv_app/invoicefile/add/ no such table: csv_app_invoicefile ==>solve this error by cmd makemigrations csv_app migrate 2)System check identified no issues (0 silenced). You have 6 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): csv_app. Run ‘python manage.py migrate’ to apply them. July 13, 2021 – 14:55:01 Django version 3.2.5, using settings ‘proj3.settings’ Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. ==>to fix this error, go to cmd enter: $python manage.py makemigrations csv_app $python manage.py migrate…
Error using pyttsx3 is a text-to-speech conversion library in Python
pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3. If running into this type of error for this pip library, you can uninstall the current version and downgrade the library, using these commands: You’ll see this notification in the console: Then try running this example again:
Reading an image file from a URL with PIL for text recognition (OCR) with pytesseract
How to upgrade pip version on your windows
Use this command when there’s a warning after you install a pip library.