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

  • Home
  • SEARCH
  • 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 6747771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:29:01+00:00 2026-05-26T12:29:01+00:00

I am having trouble reading a text file to a list, what I have

  • 0

I am having trouble reading a text file to a list, what I have at the moment is:

lines = open ('dracula.txt', 'r'). readlines ()

where dracula.txt is the text file in the same directory as the program, however upon running the program Python comes up with:

No such file or directory: 'dracula.txt'

I have no idea why it will not find the text file and read it to a list called lines, does anyone have any ideas?

  • 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-26T12:29:02+00:00Added an answer on May 26, 2026 at 12:29 pm

    The file name is looked up in the current working directory, which is not necessarily the same as the directory the script lives in. Try using the full path to the file, or make sure the working directory is correct. You can check the working directory py printing os.getcwd() from inside your script (make sure you import os).

    If you are on a case-sensitive file system, check the case of your file name.

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

Sidebar

Related Questions

I'm having some trouble reading an embedded resource (text file) in windows-8 , usually
I'm having trouble reading an entire specific line of a text file using Python.
Im having trouble reading from a CSV file final String DELIMITER = ,; Scanner
I'm having trouble reading and writing QByteArray data to a file. My goal is
I'm having trouble reading a file in UTF8 encoding into a wchar_t buffer as
I'm having some trouble reading data from a file into a vector of Orders.
I'm trying to remove vowels from a text file and am having some trouble.
I want to skip the first 17 lines while reading a text file. Let's
Hey guys I've been having some trouble skipping some unnecessary lines from the txt
I'm having troubles with reading a UTF-8 encoded text file in Hebrew. I read

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.