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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:52:10+00:00 2026-05-30T04:52:10+00:00

I have a python (v2.7.2 on OSX Lion) script that unzips an archive into

  • 0

I have a python (v2.7.2 on OSX Lion) script that unzips an archive into a new folder, and then finds a csv within those files. It then attempts to open the CSV and read through it.

This was all working as expected, up to a point. The problem i have been running into is that, when executed as described above, at times the script perceives the file to be 0 length. But when I run the same code from the command line interpreter, it sees the file correctly. Can anyone help me understand what the reason for this might be?

Pseudo Code:

# unzip the archive, locating csvfile along the way...

statinfo = os.stat(unzip_dir + "/" + csvfile)
    print statinfo

output from the above snippet:

posix.stat_result(st_mode=33188, st_ino=5318966, st_dev=234881026L, st_nlink=1, st_uid=0, st_gid=80, st_size=0, st_atime=1329963124, st_mtime=1329963124, st_ctime=1329963124)

(notice st_size=0!)

Now I go directly to the python command line and enter:

import os

statinfo = os.stat("/Users/Me/Testdir/test.csv")

print statinfo

Output from the above snippet:

posix.stat_result(st_mode=33188, st_ino=5318966, st_dev=234881026L, st_nlink=1, st_uid=0, st_gid=80, st_size=290, st_atime=1329963124, st_mtime=1329963124, st_ctime=1329963124)

As we see, st_size is now seen by Python.

I’m stumped. Any ideas? I can post more code if necessary. Thank you.

  • 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-30T04:52:12+00:00Added an answer on May 30, 2026 at 4:52 am

    You probably just forgot to flush.

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

Sidebar

Related Questions

I have two versions of python installed on my mac running OSX Lion. The
I am running OSX Lion and have installed python2.7 from python.org (this distribution can
I have Apache running on OSX Lion and MacPorts Python and some packages installed
I have a mac osx As such I have the normal python that comes
I have copied my home folder from a Mac OSX 10.5 to a new
I have a Python script that writes to a MySQL database using mysql-python .
Is it possible to have Python save the .pyc files to a separate folder
I have a Python script which needs to calculate the exact size of arbitrary
I have the following script #!/bin/sh if [cat stream_should_be_running.txt == 'true']; then #file will
I have a UTF-16 CSV file which I have to read. Python csv module

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.