shubham choubey
shubham choubey

Reputation: 31

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.

Upvotes: 3

Views: 1874

Answers (1)

Ezequiel Alanis
Ezequiel Alanis

Reputation: 451

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

Upvotes: 14

Related Questions