Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8019923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:32:19+00:00 2026-06-04T21:32:19+00:00

#!/usr/bin/python import MySQLdb import sys import csv csvfile=’/home/arun/Documents/smartearn/Linux/SA/xbrlparser/UGT-2012-Concepts.csv’ def csvparsing(): spamReader = csv.reader(open(csvfile, ‘rb’),

  • 0
#!/usr/bin/python
import MySQLdb
import sys
import csv

csvfile='/home/arun/Documents/smartearn/Linux/SA/xbrlparser/UGT-2012-Concepts.csv'
def csvparsing():

    spamReader = csv.reader(open(csvfile, 'rb'), delimiter=',', quotechar='"')

    header=spamReader.next()

    conn = MySQLdb.connect (host = "localhost",
                           user = "arunkamaly",
                           db = "se")



    cursor=conn.cursor()
    for clist in spamReader:
        name=clist[1]+clist[2]
        cursor.execute("""
    INSERT INTO se_xbrl_concepts( xbrl_id,xbrl_name,xbrl_type,Xbrl_enumerations,Xbrl_substitutiongroup,Xbrl_balance, Xbrl_periodtype, Xbrl_IsAbstract,xbrl_label,Xbrl_desc)
     values(clist[0],%s,%s,%s,%s,%s,%s,%s,clist[9],%s)""")(name,clist[3],clist[4],clist[5],clist[6],clist[7],clist[8],clist[10])
     #   print name


    conn.commit()
    cursor.close()


if(__name__=='__main__'):
    csvparsing()

the mysql table is

  Field                  | Type         | Null | Key | Default | Extra          |
+------------------------+--------------+------+-----+---------+----------------+
| xbrl_id                | bigint(20)   | NO   | PRI | NULL    | auto_increment |
| xbrl_name              | varchar(255) | NO   |     | NULL    |                |
| xbrl_type              | varchar(10)  | NO   |     | NULL    |                |
| Xbrl_enumerations      | varchar(25)  | NO   |     | NULL    |                |
| Xbrl_substitutiongroup | varchar(255) | YES  |     | NULL    |                |
| Xbrl_balance           | varchar(50)  | YES  |     | NULL    |                |
| Xbrl_periodtype        | varchar(25)  | YES  |     | NULL    |                |
| Xbrl_IsAbstract        | bit(1)       | YES  |     | NULL    |                |
| xbrl_label             | varchar(255) | YES  |     | NULL    |                |
| Xbrl_desc              | varchar(45)  | YES  |     | NULL    |                |
+------------------------+--------------+-----
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:32:21+00:00Added an answer on June 4, 2026 at 9:32 pm

    Without the error trace, it’s hard to say if this is the only error, but this is certainly one error:

    cursor.execute("""
    INSERT INTO se_xbrl_concepts( xbrl_id,xbrl_name,xbrl_type,Xbrl_enumerations,Xbrl_substitutiongroup,Xbrl_balance, Xbrl_periodtype, Xbrl_IsAbstract,xbrl_label,Xbrl_desc)
     values(clist[0],%s,%s,%s,%s,%s,%s,%s,clist[9],%s)""")(name,clist[3],clist[4],clist[5],clist[6],clist[7],clist[8],clist[10])
    

    You need a comma to separate your argument list from the string, and you need to move the parenthesis to the outside of that pair:

    cursor.execute("""
    INSERT INTO se_xbrl_concepts( xbrl_id,xbrl_name,xbrl_type,Xbrl_enumerations,Xbrl_substitutiongroup,Xbrl_balance, Xbrl_periodtype, Xbrl_IsAbstract,xbrl_label,Xbrl_desc)
     values(clist[0],%s,%s,%s,%s,%s,%s,%s,clist[9],%s)""",(name,clist[3],clist[4],clist[5],clist[6],clist[7],clist[8],clist[10]))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Firstly, here's my script: #!/usr/bin/python import sys, os sys.path.append('/home/username/python') sys.path.append(/home/username/python/flup) sys.path.append(/home/username/python/django) # more path
#!/usr/bin/python import os,sys from os import path input = open('/home/XXXXXX/ERR001268_1', 'r').read().split('\n') at = 1
So I have a file that looks like so: #!/usr/bin/python import MySQLdb import subprocess
So I found this code: #!/usr/bin/python import sys #for cmd line argv import time
I've inserted some shell commands into python script like below: #!/usr/bin/python import os,sys,re import
The code #!/usr/bin/env python import MySQLdb print Content-Type: text/html print print <html><head><title>Books</title></head> print <body>
I'm testing on my python script: #!/usr/bin/python import os,sys import glob import commands import
I'm running the following Python script: #!/usr/bin/python import os,sys from scipy import stats import
#!/usr/bin/python import wx import os import sys class MyFrame(wx.Frame): def __init__(self, parent, id, title):
okay code: #!/usr/bin/python import wx import sys class XPinst(wx.App): def __init__(self, redirect=False, filename=None): wx.App.__init__(self,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.