exceptions.ValueError Mixing iteration and read methods would lose data

I am trying to create tables from a directory containing multiple csvs using a script with psycopg2 and pandas so that the tables can be integrated into a postgreSQL database. The script should read the csvs in the folder, make pandas tables using pd.csv_read to get the column names, create a table, and then copy it's associated csv's values to it.

Here is my script thus far:

import pandas as pd
import psycopg2
import numpy as np
import os

conn = psy.connect("host=localhost dbname=somedb user=postgres password=somepw")
cur = conn.cursor()

# make a list of all the csvs to bring into pgAdmin
path = r"C:\Data\Waste_Intervention\Census_Tables\Cleaned"
fList = os.listdir(path)

# create tables in pandas to get column names for each table
# use these values to create tables with psycopg2
for doc in fList:
    pathCSV = "{}\\{}".format(path, doc)
    tableName = doc.split("_")[-1][:-4] # this strips the descriptive part of the file path
                                        # for the table name
    table = pd.read_csv(pathCSV)

    pgCols = [] # this will hold column names and data types
    types=["integer Primary Key"]
    cols = table.columns
    colsLen = len(table.columns)
    x = 1
    while x < colsLen:
        x += 1
    pgTups = zip(cols, types)
    pgCols.append(', '.join([str(lst[0]) + " " + str(lst[1]) for lst in pgTups]))
    # pgcols is now in the form column1 datatype, column2 2 datatype

    statement =  'CREATE TABLE ' + tableName + '(' + pgCols[0] + ')'
    # statement used in execute


    # tale is created. now use same file in csv_read to copy data into table
    with open(pathCSV, 'r') as f:
        cur.copy_from(f, tableName, sep=',')

This is throwing the following error:

QueryCanceledError                        Traceback (most recent call last)
<ipython-input-242-4d5401b7a834> in <module>()
     31     with open(pathCSV, 'r') as f:
     32         next(f)
---> 33         cur.copy_from(f, tableName, sep=',')
     34     conn.commit()
QueryCanceledError: COPY from stdin failed: error in .read() call: exceptions.ValueError Mixing iteration and read methods would lose data
CONTEXT:  COPY age, line 1

I tried using cur.seek(0) to reset the cursor as suggested here:Python: ValueError: Mixing iteration and read methods would lose data

but this throws an error that cursor object has no attribute 'seek'