Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database connectivity through MySQL connector Python with CGI is not working

Actually I am using Ubuntu 16.04 and python3 so in that when I am importing MySQL.connector and CGI in a single file the file is not working showing the error

#!/usr/bin/python3
import cgi

import mysql.connector as msql

Segmentation fault (core dumped).

These both are not working simultaneously but working individually.

like image 341
shubham choubey Avatar asked Jun 05 '26 12:06

shubham choubey


1 Answers

I don´t know why but in my case changing the order on imports solved the problem

With this imports:

import sys, pdfplumber, json, io, re, getpass
import mysql.connector as mariadb

I get Segmentation fault (core dumped)

I changed the imports order letting mysql.connector first

import mysql.connector as mariadb
import sys, pdfplumber, json, io, re, getpass

And my script ran flawlessly

It took me whole day to solve it.... hope it helps

like image 180
Ezequiel Alanis Avatar answered Jun 07 '26 08:06

Ezequiel Alanis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!