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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:59:41+00:00 2026-05-20T21:59:41+00:00

I started now to learn Python, so my question is kinda stupid I have

  • 0

I started now to learn Python, so my question is kinda stupid

I have this piece of code

#!/usr/local/bin/python3
# encoding: utf-8

fh = open("lines.txt")

for lines in readlines():
    print(lines)

the text file lines.txt exits and it is at the same directory of my page, I using Komodo Edit, when I run the file, I get this error.

    Traceback (most recent call last):
  File "/Users/Jeff/Sites/PythonLearning/forloop.py", line 4, in <module>
    fh = open("lines.txt")
IOError: [Errno 2] No such file or directory: 'lines.txt'

Funny thing, if i open this file in IDLE, it works nicely, as well if I open in Mac os X terminal!

Thanks a lot!!

  • 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-20T21:59:41+00:00Added an answer on May 20, 2026 at 9:59 pm

    You’re getting this error because by default when you run a script in Komodo Edit it does not run it from the directory the script is saved in (unlike when you run normally from the command terminal).

    To fix this – when you select the ‘Run Command‘ option in Komodo Edit – Click ‘More‘ to bring down a further options list and then in the ‘Start In‘ field enter %D. This tells Komodo to run the script from the directory it is in and should solve your problem.

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

Sidebar

Related Questions

I have used this question to learn install my python script as a service
Few hours ago I have started to learn java socket comunication. Now I'm trying
I have recently started to learn using of Doctrine 2.0 framework for PHP. Now
I have started to learn ASP.NET MVC, and at this time of studying I
I am new with ruby... and now I've started to learn patterns. Is this
Now I'm following one more friend and now I started to learn PLT Scheme(using
I'm recently started to learn Twisted framework and now looking for some cheat sheets/reference
I just started to learn about mod rewrite process. Now, I got some problems
Not so long ago I started to learn to use System.Reflection.Emit namespace. I'm now
Ok guys, I started to learn more about Jquery and now I could make

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.