Categories
Mastering Development

Unable to pass arguments in python3 class

Firstly, I created a class that has __init__() on it in models.py, as you can see below. And when I import it in my views.py, the vscode intellisense also shows that my class takes 4 arguments. But when I try to run the program, it shows me an error saying that the class doesn’t take […]

Categories
Mastering Development

How to setup Pyglet to work with Manim in Colab?

I’m trying to run shaders version of Manim in Colab. This version has to show rendered video in a live interactive window, as opposed to just writing mp4. I installed and imported everything without errors: from manimlib.imports import * but get an exception when run: !python3 -m manim example_scenes.py OpeningManimExample Media will be written to […]

Categories
Mastering Development

Flask RuntimeError: Working outside of request context

In my Flask app, I have a cookie being set in the following authorization context: project/ api/ routes/ spotify_auth.py spotify_auth.py from flask import Blueprint from flask import Flask, request, session, redirect spotify_auth_bp = Blueprint(‘spotify_auth’, __name__, template_folder=’templates’, static_url_path=’static’) @spotify_auth_bp.route(“/callback”, methods=[‘GET’, ‘POST’]) def spotify_callback(): session.clear() # Auth Step 4: Requests refresh and access tokens SPOTIFY_TOKEN_URL = “https://accounts.spotify.com/api/token” […]

Categories
Mastering Development

MySQL 5.7: fine tuning for too many connections error

I have an old django 1.9 application connected to a mysql 5.7 database. Sometime I get this error: [Fri Mar 20 10:27:19.482820 2020] [wsgi:error] [pid 15215] ” [Fri Mar 20 10:28:20.502889 2020] [wsgi:error] [pid 15215] [NXU ts_fw20] [2020-03-20 Fri 10:28:20.1584696500]ERROR “Exception during GET request (user: AnonymousUser): <QueryDict: {u’udid’: [u’B8663A17-C121-4691-A561-E0F698CDD4EA’], u’client_os_version’: [u’13.3.1′], u’client_app_version’: [u’11.30.1.201910161040′], u’client_app_type’: [u’Jukebox’], […]

Categories
Mastering Development

super().__init__(*args, **kwargs) TypeError: __init__() got an unexpected keyword argument ‘max_lenght’

Traceback (most recent call last): File “manage.py”, line 21, in <module> main() File “manage.py”, line 17, in main execute_from_command_line(sys.argv) File “C:\Users\MobilineWest\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py”, line 401, in execute_from_command_line utility.execute() File “C:\Users\MobilineWest\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py”, line 377, in execute django.setup() File “C:\Users\MobilineWest\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py”, line 24, in setup apps.populate(settings.INSTALLED_APPS) File “C:\Users\MobilineWest\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py”, line 114, in populate app_config.import_models() File “C:\Users\MobilineWest\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\config.py”, line 211, in import_models self.models_module = […]

Categories
Mastering Development

pygame.error: video system not initialized (Alien Invasion)

I’m currently following a python tutorial on a book and have finally coming to creating a pygame. After manually typing each code, import sys import pygame from settings import Settings from ship import Ship def run_game(): pygame.init() ai_settings = Settings() screen = pygame.display.set_mode( (ai_settings.screen_width, ai_settings.screen_height)) pygame.display.set_caption(“Alien Invasion”) ship = Ship(screen) bg_color = (230, 230, 230) […]

Categories
Mastering Development System & Network

After installing openstack with devstack,I got this error,Get Internal Server Error error when i want to access to IPAddress/dashboard

I installed openstack with devstack on a fresh ubuntu server, I ran ./stack.sh and it was down, but when i want to access to dashboard, i get this error on browser Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at […]

Categories
Mastering Development

ValueError: Field ‘id’ expected a number but got ‘select’

When I run the “python manage.py migrate” command Error is occuring: Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions, travello Running migrations: Applying travello.0005_auto_20200313_1046…Traceback (most recent call last): File “C:\Users\uc\Envs\test\lib\site-packages\django\db\models\fields__init__.py”, line 1772, in get_prep_value return int(value) ValueError: invalid literal for int() with base 10: ‘select’ The above exception was the direct cause of […]

Categories
Mastering Development

in Vscode, RuntimeError: ‘path’ must be None or a list, not

I use Ubuntu and Vscode. In my Django project, I’ve tried to run python manage.py process_tasks command and I got this error below. Traceback (most recent call last): File “manage.py”, line 21, in <module> main() File “manage.py”, line 17, in main execute_from_command_line(sys.argv) File “/home/../venv/lib/python3.6/site-packages/django/core/management/__init__.py”, line 381, in execute_from_command_line utility.execute() File “/home/../venv/lib/python3.6/site-packages/django/core/management/__init__.py”, line 375, in execute […]

Categories
Mastering Development

flask_restful – TypeError: Object of type Record is not JSON serializable

I try to provide a custom object inside a rest api, created with flask_restful. Object: Record import json class Record(): #CLASS RECORD def __init__(self, DateTime, DateTimeText, Status, Icon, Temp): #INITIALIZE self.DateTime = DateTime self.DateTimeText = DateTimeText self.Status = Status self.Icon = Icon self.Temp = Temp def __repr__(self): return json.dumps(self, default=lambda o: o.__dict__, sort_keys=False, indent=4) Result: […]