0

I'm trying to run a program which connects to all databases(mysql,sqlite) and fetch data from it .

Python version - 3.6.8

Since the code is too long ,i'm showing only particular snippets.

def show_columns_mysql(cursor,tbname):
    cursor.execute("""show columns from %s"""%(tbname))
    rs=cursor.fetchall()
    colname=[]
    for i in rs:
        colname.append(i[0])
    return colname

There is no problem or issue if i exexute the program in normal python environment . When i try to execute this in virtual environment ,it shows me No module named 'cPickle' .

I have tried all the solutions but none solved my problem .

What was the problem ?

  • are you using `six` package by any chance? – R4444 Aug 06 '19 at 05:49
  • 2
    Possible duplicate of [Can't find module cPickle using Python 3.5 and Anaconda](https://stackoverflow.com/questions/49579282/cant-find-module-cpickle-using-python-3-5-and-anaconda) – R4444 Aug 06 '19 at 05:49
  • no i'm not using it .some people suggested to use six package .so when i checked using pip show six , it is installed – Gomathimeena Subburayan Aug 06 '19 at 05:51

2 Answers2

2

There is no cPickle in Python 3. Just import pickle. pickle will automatically use the C accelerator.

-1

Install pickle. Then do:

import pickle as cPickle
R4444
  • 2,016
  • 2
  • 19
  • 30
  • when i try to install pickle : Collecting pickle ERROR: Could not find a version that satisfies the requirement pickle (from versions: none) ERROR: No matching distribution found for pickle – Gomathimeena Subburayan Aug 06 '19 at 05:55