Category : python-3.x

I’m in the process of changing an app name in Django and running into this InconsistentMigrationHistory exception. The first thing I did, described in this SO answer, was change the name of the app directory and all references to the app. I made some SQL statements to rename account to authentication in the django_content_type table, ..

Read more

I am trying to fetch rest api from XYZ provider inside python/flask webApp I used this as example/guide https://help.parsehub.com/hc/en-us/articles/217751808-API-Tutorial-How-to-get-run-data-using-Python-Flask I dont have api key but auth token so this is code I am using and returns alldata `from flask import Flask, render_template import requests import json app = Flask(__name__) @app.route(‘/’) def homepage(): headers = { ..

Read more

Issue: When I try to copy the code and run it from the tutorial page https://square.github.io/pysurvival/tutorials/credit_risk.html , the pysurvival package is successfully installed. But when I run this code: from pysurvival.utils.display import correlation_matrix it shows the error message as follow: ImportError: dlopen(/Users/aa/opt/anaconda3/lib/python3.7/site-packages/pysurvival/models/_non_parametric.cpython-37m-darwin.so, 2): Symbol not found: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4 Referenced from: /Users/aa/opt/anaconda3/lib/python3.7/site-packages/pysurvival/models/_non_parametric.cpython-37m-darwin.so Expected in: /usr/lib/libstdc++.6.dylib in /Users/ju/opt/anaconda3/lib/python3.7/site-packages/pysurvival/models/_non_parametric.cpython-37m-darwin.so ..

Read more

I am getting <PermissionError: [Errno 13] Permission denied: ‘icon.ico’>, only when my script runs on startup. When I run it from the same location, same file, it is running properly. I added as Value to "ComputerHKEY_CURRENT_USERSOFTWAREMicrosoftWindowsCurrentVersionRun" in the Registry, the location of my script (compiled to .exe with pyinstaller). Basically on my code, I have ..

Read more

I have a python script written to connect to an SQLite3 database in PyCharm to read the data. I am unable to read the data from the database, I think I am searching for the database incorrectly. import sqlite3 conn = sqlite3.connect(‘jdbc:sqlite:identifier.sqlite’) c = conn.cursor() c.execute("SELECT * FROM database1") When I run the code I ..

Read more

Currently I have something like this: from pydantic.main import BaseModel class Data(BaseModel): id: int data: typing.OrderedDict[str, Any] = OrderedDict() Values of data field must have any data type: strings, integers, floats, dates, lists, etc. One of my problems is deserializing this data. In deserialization I lose some types of data like dates and times. My ..

Read more

I’m pretty new to Python and have recently learned about classes. I’ve been experimenting around with them and have come up with a student/course grading system. Here’s the code so far: class course: TOTAL_COURSES = 0 def __init__(self, name, room, max_students): self.name = name self.room = room self.max_students = max_students self.student_list = [] course.TOTAL_COURSES += ..

Read more

I am iterating through a list and trying to appended values to a Dict[str, list] called plot. I look up the str-type key (real_key) to the appropriate list in plot and then I append a value (value) to that list. some = x[‘string’] for od in some: conversion_key = od.get("@alias") real_key = field_conversion[conversion_key] value = ..

Read more