Documentation on debugging issue for creating database

While running the crawler code to extract data about the categories(Beauty -> Tools and Accessories  products) in amazon.in,  I had come across the following error. I will be showing what I had done to rectify the error.

runfile(‘C:/Users/Dell/Documents/Quilt/quilt-beauty/quilt-beauty/amazon_beauty_skin_crawler.py’, wdir=’C:/Users/Dell/Documents/Quilt/quilt-beauty/quilt-beauty’)

Error tokenizing data. C error: Expected 7 fields in line 68, saw 8

If you look at the database, the database will be empty.

To look at the database, open the ‘db.sqlite3’ file using DB Browser (SQLite) application.

To rectify the error, we need to open the .csv in a normal word editor e.g. notepad++

You will be able to see the ‘ ” ’ double quotes at the beginning and at the end.

Remove the double quotes and save the text file.

NOTE: If there are already data in the database, to remove the data from the database do the following.

Open the db.sqlite3 file using DB Browser (SQLite) application.

Go to ‘Execute SQL’ tab

Type the following command

delete from file_name

delete from beauty_skin_categories

The above command will delete the data that was present in the database.

To execute the command run the command, click the run button.

After running the command click ‘Write Changes’

Then open Spyder and run the code. This time it should work.

The database for the beauty_skin_categories table will be created.