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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:47:40+00:00 2026-05-29T04:47:40+00:00

I kind of wrote this piece of code: import csv import os fileobj =

  • 0

I kind of wrote this piece of code:

import csv
import os
fileobj = csv.reader(open('c:\\paths1.csv', 'rb'), delimiter=' ', quotechar='|')
for row in fileobj:
    x=0 

    for x in fileobj:
        filesize= os.path.getsize(x)

    print (filesize);

However I’m still receiving this error:

Traceback (most recent call last):
  File "C:\Documents and Settings\Administrator\workspace\test1py\Acol.py", line 9, in <module>
    filesize= os.path.getsize(x)
  File "C:\Python27\lib\genericpath.py", line 49, in getsize
    return os.stat(filename).st_size
TypeError: coercing to Unicode: need string or buffer, list found

I guess it’s cos’ fileobj contains a list of path…

Does anyone have any suggestions?

  • 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-05-29T04:47:41+00:00Added an answer on May 29, 2026 at 4:47 am

    You want

    for x in row: # NOT   in fileobj
        filesize = os.path.getsize(x)
    

    By the way, the line x = 0 has no effect but to confuse the unsuspecting reader. You should remove it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote this piece of code to scan a directory for files newer than
Kind of need help understanding what this code actually outputs. Does it out put
Can i write something like this in WPF(i know that this piece of code
Sometimes I face I must write a piece of code like this (usually it
First a little intro: Last year i wrote this http://dragan.yourtree.org/code/canvas-3d-graph/ Now, i want to
I'm trying to write a piece of code for a kind of tree I'm
Kind of like this question I have many text snippets that I use many,
What kind of problems might this cause? Is it better to install in a
I kind of feel like I'm abusing the DOM with my code... for(var i=0;
Ok, I am an amateur programmer and just wrote this. It gets the job

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.