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 9298193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:15:42+00:00 2026-06-18T22:15:42+00:00

I am trying to read a csv file exported from Microsoft Excel, looking like

  • 0

I am trying to read a csv file exported from Microsoft Excel, looking like this:

114.9;280.9;501.5;0;W10;Firewall south;A;1;2;;
119.0;280.9;501.5;0;W10;Southern escape route;B;2;3;asdasdf;
120.5;280.0;501.5;0;W10;Southern escape route;C;3;4;;

The delimiter is semicolon and some of the columns might be empty. For example column 10 may be populated with asdasdf as an example. My code looks like this:

reader = csv.reader(open(inFile), delimiter=";")

nodesTable = window.getNodesTable()
pathsTable = window.getPathsTable()
clearTable(nodesTable)
clearTable(pathsTable)

for x, y, z, safe, mod, descr_node, name, start, end, descr_path in reader:
    nodesTable.SetStringItem(counter, nodesTable_ID_x, x)
    nodesTable.SetStringItem(counter, nodesTable_ID_y, y)
    nodesTable.SetStringItem(counter, nodesTable_ID_z, z)
    nodesTable.SetStringItem(counter, nodesTable_ID_SafeArea, safe)
    nodesTable.SetStringItem(counter, nodesTable_ID_Module, mod)
    nodesTable.SetStringItem(counter, nodesTable_ID_Description, descr_node)

    pathsTable.SetStringItem(counter, pathsTable_ID_Name, name)
    pathsTable.SetStringItem(counter, pathsTable_ID_StartNode, start)
    pathsTable.SetStringItem(counter, pathsTable_ID_EndNode, end)
    pathsTable.SetStringItem(counter, pathsTable_ID_Description, descr_path)

I am getting the error ValueError: too many values to unpack. What am I doing wrong here?

  • 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-18T22:15:44+00:00Added an answer on June 18, 2026 at 10:15 pm

    There are 10 semicolons in each line of your CSV file, which means, that the line will be splitted into 11 elements. In your for loop, there are only 10 variables used. Change the line into:

    for x, y, z, safe, mod, descr_node, name, start, end, descr_path, _ in reader:
    

    and ignore the _ variable, which will get the empty character between the last ; in the line and the end of line.

    Or change your whole loop into:

    cols = (nodesTable_ID_x, nodesTable_ID_y, nodesTable_ID_z,
            nodesTable_ID_SafeArea, nodesTable_ID_Module,
            nodesTable_ID_Description, pathsTable_ID_Name,
            pathsTable_ID_StartNode, pathsTable_ID_EndNode,
            pathsTable_ID_Description)
    
    for rec in reader:
        for col, val in zip(cols, rec):
            nodesTable.SetStringItem(counter, col, val)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read in a CSV file that looks like this: ruby,2,100
I am trying to read this .csv file and here is an example of
I'm trying to read CSV from a text file in C. The text file
I have created CSVReader and I am trying to read csv file from assets
Hi I'm trying to read csv file, my code is this: CSV.foreach(path, {:col_sep =>
I'm trying to read a CSV file generated by M$ Excel on linux. The
I have been trying to read a csv file from my desktop and have
I am trying to read from csv file. The file contains UTF-8 characters. So
I am trying to read a csv file from assets/file.csv, but the log keeps
I'm trying to read time series from CSV file and save them as xts

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.