Giter Site home page Giter Site logo

flask-mysqldb's People

Contributors

admiralobvious avatar alexferl avatar dependabot[bot] avatar liova99 avatar shaunpud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flask-mysqldb's Issues

unable to install flask-mysqldb in google app engine

Hey Guys,

I'm trying to install flask-mysqldb in my app engine environment and I get the following error.

Collecting flask-mysqldb Using cached https://files.pythonhosted.org/packages/62/e3/955c845efe1aacf30c8e2607470544ede36aa1044f6382c809f13e014104/Flask-MySQLdb-0.2.0.tar.gz
Collecting Flask>=0.10 (from flask-mysqldb) Using cached https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl Collecting mysqlclient (from flask-mysqldb)
Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz
Complete output from command python setup.py egg_info: sh: 1: mysql_config: not found
Traceback (most recent call last): File "", line 1, in
File "/tmp/pip-install-i07vlu/mysqlclient/setup.py", line 18, in metadata, options = get_config()
File "setup_posix.py", line 53, in get_config libs = mysql_config("libs_r")
File "setup_posix.py", line 28, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-i07vlu/mysqlclient/

any help would be very appreciated.

Thanks!

Can't Commit Queries

Usually you can get a connection object and then call connection.commit() to commit all the changes after executing an insert/update query. Is there a way to do this with this plugin?

Failed to establish database connection, I wanted to retrieve the db_config

import requests
from sql_database_module import SQLDatabase # Importing necessary modules

class DatabaseConnection:
"""
A class to represent a database connection.

Attributes:
    db: The database connection object.
"""
def __init__(self, username, password, hostname, port, database):
    """
    Initializes a DatabaseConnection object.

    Parameters:
        username (str): The username for the database connection.
        password (str): The password for the database connection.
        hostname (str): The hostname of the database server.
        port (int): The port number for the database connection.
        database (str): The name of the database.

    Returns:
        None
    """
    try:
        self.db = SQLDatabase.from_uri(f"postgresql://{username}:{password}@{hostname}:{port}/{database}")
    except Exception as e:
        print(f"Error initializing database connection: {e}")
        self.db = None

def select_db(username, password, hostname, port, database):
"""
Function to select a database.

Parameters:
    username (str): The username for the database connection.
    password (str): The password for the database connection.
    hostname (str): The hostname of the database server.
    port (int): The port number for the database connection.
    database (str): The name of the database.

Returns:
    DatabaseConnection: A DatabaseConnection object representing the selected database.
"""
return DatabaseConnection(username, password, hostname, port, database)

def get_db_config():
"""
Function to retrieve database configuration from an API endpoint.

Returns:
    dict or None: A dictionary containing database configuration if successful, otherwise None.
"""
try:
    api_endpoint = 'http://192.168.14.28:84/db_connection'  
    response = requests.get(api_endpoint)
    if response.status_code == 200:
        return response.json().get('db_config')
    else:
        print(f"Error: Failed to retrieve db_config from API endpoint. Status code: {response.status_code}")
        return None
except Exception as e:
    print(f"Error retrieving db_config: {e}")
    return None

def establish_db_connection():
"""
Function to establish a database connection using configuration retrieved from an API endpoint.

Returns:
    SQLDatabase or None: A SQLDatabase object representing the established database connection, or None if unsuccessful.
"""
try:
    db_config = get_db_config()
    if db_config:
        return SQLDatabase.from_uri(
            f"postgresql://{db_config['username']}:{db_config['password']}@{db_config['hostname']}:{db_config['port']}/{db_config['database']}"
        )
    else:
        print("Error: Failed to obtain db_config from the API endpoint.")
        return None
except requests.RequestException as e:
    print(f"Request to API endpoint failed: {e}")
    return None
except KeyError as e:
    print(f"Missing key in db_config JSON: {e}")
    return None
except Exception as e:
    print(f"Error establishing database connection: {e}")
    return None

UPDATE, INSERT not working for me

def insert_test(mysql):
    cur = mysql.connection.cursor()
    try: 
        query="insert into tag(name) values ('test')"
        ok=cur.execute(query)
        cur.close()
        print(ok)
    except:
        print ("could not insert row")

displays 1 in my console but database does not get updated

is there anything i'm missing ? because SELECT works

No module named flaskext.mysql

Hello,

I don't understand what I am doing wrong...
I pip install and then tried from flaskext.mysql import MySQLor from flask_mysqldb import MySQL but I can't get it working : No module named flask_mysqldb. Am I the only one ?

Any clue ?

Thx !

Unable to install flask-mysqldb in mac

Darshans-MacBook-Air:CrudWithFlask-4 ddd$ pip3 install Flask-Mysqldb
Collecting Flask-Mysqldb
Using cached Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from Flask-Mysqldb)
Collecting mysqlclient (from Flask-Mysqldb)
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/l0/3dzllb2j4djb18jr5j82fvpr0000gn/T/pip-build-ltokdkl1/mysqlclient/setup.py", line 17, in
metadata, options = get_config()
File "/private/var/folders/l0/3dzllb2j4djb18jr5j82fvpr0000gn/T/pip-build-ltokdkl1/mysqlclient/setup_posix.py", line 54, in get_config
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/var/folders/l0/3dzllb2j4djb18jr5j82fvpr0000gn/T/pip-build-ltokdkl1/mysqlclient/setup_posix.py", line 54, in
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/var/folders/l0/3dzllb2j4djb18jr5j82fvpr0000gn/T/pip-build-ltokdkl1/mysqlclient/setup_posix.py", line 12, in dequote
if s[0] in ""'" and s[0] == s[-1]:
IndexError: string index out of range


Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/l0/3dzllb2j4djb18jr5j82fvpr0000gn/T/pip-build-ltokdkl1/mysqlclient/

Error install the package

I am trying to install the package for my flask app and I get the following error -

Collecting flask-mysqldb
  Using cached https://files.pythonhosted.org/packages/62/e3/955c845efe1aacf30c8e2607470544ede36aa1044f6382c809f13e014104/Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in ./env/lib/python3.5/site-packages (from flask-mysqldb) (1.0.2)
Collecting mysqlclient (from flask-mysqldb)
  Using cached https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-9pf1mpmn/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-9pf1mpmn/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-install-9pf1mpmn/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-9pf1mpmn/mysqlclient/

I am using a virtual environment and made sure that setuptools is installed and up to date.

Python version - Python 3.5.2

Can you please help me? What is possibly going wrong here?

AssertionError: A setup function was called after the first request was handled. Error in line mysql = MySQL(app)

from flask import Flask, render_template, url_for, redirect
from flask_mysqldb import MySQL
from flask import request, Response
import json
import yaml
from wtforms import *

import sqlparse
from sqlparse.sql import IdentifierList, Identifier
from sqlparse.tokens import Keyword, DML

import sqlparse
import MySQLdb._mysql
import pandas
import datacompy
from mysql.connector import Error

app = Flask(name, instance_relative_config=True)
mysql = MySQL()
app.config.from_object(name)

db = yaml.load(open('db.yaml'))
app.config['MYSQL_HOST'] = db['mysql_host']
app.config['MYSQL_USER'] = db['mysql_user']
app.config['MYSQL_PASSWORD'] = db['mysql_password']
app.config['MYSQL_DB'] = db['mysql_db']
mysql.init_app(app)

#Error in line mysql = MySQL(app)
@app.route('/respostas/int:pergunta_id/int:aluno_id', methods=['POST'])
def resposta_insert(pergunta_id, aluno_id):
form = RespostaForm(request.form)
if request.method == 'POST' and form.validate():
# VERIFICA SE OS FORMULARIOS ESTAO BEM FEITOS
resposta_sql = request.form["resposta_sql"]
# INSERE NA BASE DE DADOS A NOVA RESPOSTA
try:
from flask_mysqldb import MySQL
mysql = MySQL(app)
#global mysql
cur = mysql.connection.cursor()
except Error as e:
print()
print("Error while connecting to MySQL", e)
print()
finally:
from flask_mysqldb import MySQL
mysql = MySQL(app)
print("MYSQL *************************")
print(mysql)
conn = mysql.connection()
cur = conn.cursor()

Error in line mysql = MySQL(app)

Is this library safe agains mysql injections?

Is it a security concern if I use the following approach to get data from my database?

    def execute_query(self, query: str) -> list:
            """
            Execute a query on the database and return the result.
    
            Args:
              query (str): The query to execute.
    
            Returns:
              list: The result of the query.
            """
            cursor = self.mysql.connection.cursor()
            cursor.execute(query)
            result = cursor.fetchall()
            cursor.close()
            return result

If it's not safe can anyone suggest a better way to interact with my MySQL server with flask?

Error while installing with pip

I tried to install it with pip on MacOS

pip3 install flask-mysqldb

This is what I got in return:

$ pip3 install flask-mysqldb
Collecting flask-mysqldb
  Using cached Flask-MySQLdb-0.2.0.tar.gz (2.1 kB)
Requirement already satisfied: Flask>=0.10 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from flask-mysqldb) (1.1.2)
Collecting mysqlclient
  Using cached mysqlclient-2.0.1.tar.gz (87 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sf/g8jsr5hx61707p3x_l30042r0000gn/T/pip-install-lww9m60l/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/sf/g8jsr5hx61707p3x_l30042r0000gn/T/pip-install-lww9m60l/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/sf/g8jsr5hx61707p3x_l30042r0000gn/T/pip-pip-egg-info-geftj76p
         cwd: /private/var/folders/sf/g8jsr5hx61707p3x_l30042r0000gn/T/pip-install-lww9m60l/mysqlclient/
    Complete output (12 lines):
    /bin/sh: mysql_config: command not found
    /bin/sh: mariadb_config: command not found
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/sf/g8jsr5hx61707p3x_l30042r0000gn/T/pip-install-lww9m60l/mysqlclient/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "/private/var/folders/sf/g8jsr5hx61707p3x_l30042r0000gn/T/pip-install-lww9m60l/mysqlclient/setup_posix.py", line 65, in get_config
        libs = mysql_config("libs")
      File "/private/var/folders/sf/g8jsr5hx61707p3x_l30042r0000gn/T/pip-install-lww9m60l/mysqlclient/setup_posix.py", line 31, in mysql_config
        raise OSError("{} not found".format(_mysql_config_path))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Please respond to the earliest

Unable to install flask-mysqldb on Linux : _mysql.c:32:20: fatal error: Python.h: No such file or directory

Hi there ! I was trying to install flask-mysqldb on my Linux 16.04 device but I encountered a problem, even with a virtual environment: _mysql.c:32:20: fatal error: Python.h: No such file or directory.

(myFlaskAppenv) mike@mike-thinks:~/Programing/Rasa/myflaskapp$ python -m  pip install flask-mysqldb
Collecting flask-mysqldb
  Using cached https://files.pythonhosted.org/packages/62/e3/955c845efe1aacf30c8e2607470544ede36aa1044f6382c809f13e014104/Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in ./myFlaskAppenv/lib/python3.5/site-packages (from flask-mysqldb) (1.0.2)
Collecting mysqlclient (from flask-mysqldb)
  Using cached https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz
Requirement already satisfied: itsdangerous>=0.24 in ./myFlaskAppenv/lib/python3.5/site-packages (from Flask>=0.10->flask-mysqldb) (0.24)
Requirement already satisfied: Jinja2>=2.10 in ./myFlaskAppenv/lib/python3.5/site-packages (from Flask>=0.10->flask-mysqldb) (2.10)
Requirement already satisfied: Werkzeug>=0.14 in ./myFlaskAppenv/lib/python3.5/site-packages (from Flask>=0.10->flask-mysqldb) (0.14.1)
Requirement already satisfied: click>=5.1 in ./myFlaskAppenv/lib/python3.5/site-packages (from Flask>=0.10->flask-mysqldb) (6.7)
Requirement already satisfied: MarkupSafe>=0.23 in ./myFlaskAppenv/lib/python3.5/site-packages (from Jinja2>=2.10->Flask>=0.10->flask-mysqldb) (1.0)
Installing collected packages: mysqlclient, flask-mysqldb
  Running setup.py install for mysqlclient ... error
    Complete output from command /home/mike/Programing/Rasa/myflaskapp/myFlaskAppenv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rpj3mj09/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-r7zvujiv/install-record.txt --single-version-externally-managed --compile --install-headers /home/mike/Programing/Rasa/myflaskapp/myFlaskAppenv/include/site/python3.5/mysqlclient:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb
    copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.5/MySQLdb
    copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.5/MySQLdb
    copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.5/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.5/MySQLdb
    copying MySQLdb/release.py -> build/lib.linux-x86_64-3.5/MySQLdb
    copying MySQLdb/times.py -> build/lib.linux-x86_64-3.5/MySQLdb
    creating build/lib.linux-x86_64-3.5/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.5/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.linux-x86_64-3.5
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 -I/usr/include/mysql -I/home/mike/Programing/Rasa/myflaskapp/myFlaskAppenv/include -I/usr/include/python3.5m -c _mysql.c -o build/temp.linux-x86_64-3.5/_mysql.o
    _mysql.c:32:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/mike/Programing/Rasa/myflaskapp/myFlaskAppenv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rpj3mj09/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-r7zvujiv/install-record.txt --single-version-externally-managed --compile --install-headers /home/mike/Programing/Rasa/myflaskapp/myFlaskAppenv/include/site/python3.5/mysqlclient" failed with error code 1 in /tmp/pip-install-rpj3mj09/mysqlclient/

What may I do then to install it ?

Unable to set configuration

I added the configuration to root but it takes prasi as the user somehow from my pycharm studio.

app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'hellozzz'
app.config['MYSQL_DATABASE_DB'] = 'MSGQ'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'


mysql = MySQL(app)
mysql.init_app(app)

@app.route('/users')
def users():
    cur = mysql.connection.cursor()
    cur.execute('''SELECT * FROM user_devices''')
    rv = cur.fetchone()
    return str(rv)

_mysql_exceptions.OperationalError: (1045, "Access denied for user 'prasi'@'localhost' (using password: NO)")

[FIXED] Error while trying to install mysqldb

I ran a command pip install flask-mysqldb and I get this

Collecting flask-mysqldb
  Using cached Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in ./venv/lib/python3.6/site-packages (from flask-mysqldb)
Collecting mysqlclient (from flask-mysqldb)
  Using cached mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-wrldt09x/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-wrldt09x/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-wrldt09x/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wrldt09x/mysqlclient/

I was missing mysql_config for some reason, needed to install sudo apt-get install libmysqlclient-dev first, and then it worked.

...

ใ€‚ใ€‚

escape_string not available

I'm not seeing where escape_string is available.

Currently, I am having to import extra stuff to escape strings:

from MySQLdb import escape_string

Can this be included into flask-mysqldb please?

Error while installing using Pip

I get an issue while trying to install it using pip. I use the following:
pip3 install flask-mysqldb
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

'NoneType' object has no attribute 'cursor'

Hello. I'm using Python3 and have the following code. I'm getting 'NoneType' object has no attribute 'cursor' when I'm trying to use mysql.connection.cursor(). What's wrong with that? Please take to consideration, that I'm using according to the official manual page which is https://flask-mysqldb.readthedocs.io/en/latest/

from flask_mysqldb import MySQL
from flask import Flask, request
app = Flask(name)

app.config['MYSQL_HOST'] = 'someip'
app.config['MYSQL_USER'] = 'someuser'
app.config['MYSQL_PASSWORD'] = 'password'
app.config['MYSQL_DB'] = 'rooms'

mysql = MySQL(app)
cur = mysql.connection.cursor()

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

### I installed the whitelibrary library but got this error. Can somebody help me

C:\WINDOWS\system32>pip install --upgrade robotframework-whitelibrary
Collecting robotframework-whitelibrary
Using cached robotframework_whitelibrary-1.6.0-py2.py3-none-any.whl (298 kB)
Requirement already satisfied, skipping upgrade: robotframework in c:\users\leesy\appdata\local\programs\python\python38-32\lib\site-packages (from robotframework-whitelibrary) (3.1.2)
Collecting pythonnet; sys_platform == "win32"
Using cached pythonnet-2.4.0.tar.gz (1.8 MB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\leesy\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\leesy\AppData\Local\Temp\pip-install-78cc7ct9\pythonnet\setup.py'"'"'; file='"'"'C:\Users\leesy\AppData\Local\Temp\pip-install-78cc7ct9\pythonnet\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\leesy\AppData\Local\Temp\pip-install-78cc7ct9\pythonnet\pip-egg-info'
cwd: C:\Users\leesy\AppData\Local\Temp\pip-install-78cc7ct9\pythonnet
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\leesy\AppData\Local\Temp\pip-install-78cc7ct9\pythonnet\setup.py", line 18, in
from wheel import bdist_wheel
ModuleNotFoundError: No module named 'wheel'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Executing an Insert query breaks Python script.

Hi,
I have encountered an issue when executing INSERT query with flask_mysqldb. Basically, INSERTs are taking long time, and once commited, python script is not responsive. It looks like connection to database breaks.

Here is my python script:

https://github.com/humnchain/humnchain-web-service/blob/master/app.py

Below is my env:

Client:
Windows 10
Python 2.7.12
Flask 0.11.1
Flask-MySQLdb 0.2.0
mysqlclient 1.3.7
Jinja2 2.8
Werkzeug 0.11.10

Server:
MySQL server: 5.7.13 (Ubuntu)

Pip install flask-mysqldb results in error

Having trouble using the library because I can only install the .whl, and for some reason it's not "registered" so my app picks it up.

My error is here:

Command "c:\users\there\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;file='C:\Users\there\AppData\Local\Temp\pip-install-7gfeybon\mysqlclient\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\there\AppData\Local\Temp\pip-record-2i1evwnn\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\there\AppData\Local\Temp\pip-install-7gfeybon\mysqlclient\

I guess this is why a virtual environment is so beneficial

ImportError

ImportError: cannot import name '_app_ctx_stack' from 'flask'
File : init.py
Flask Version: 3.0.0
Flask-MySQLdb Version: 1.0.1
Given that in flask

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.