This forum has been archived. All content is frozen. Please use KDE Discuss instead.

error message in debug when using relative path in python

Tags: None
(comma "," separated)
asharma74
Registered Member
Posts
1
Karma
0
I am writing my data to a file and have opened a file in the following way:
outfilename = "mcc_dataout.txt"
outfile = outfilepath + outfilename
fout = open(outfile, "w")
These lines are right at the beginning of my main() program.

Every time I execute the program, it runs without any error, but when I debug it gives me the following error whenever the debug reaches the fout line:
fout = open(outfile, "w")
IOError: [Errno 2] No such file or directory: '../data/mcc_dataout.txt'

I am using Arch Linux + Kdevelop 4.4 .1 + kdev-python1.4.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Are you invoking this debug run from within KDevelop?
If so, please checking the current working directory for the script - ../data likely does not exist from that position - preventing the automatic creation of the file.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
It is well possible that this behaviour is a bug. I just implemented it "as is", without paying special attention to working directories.
Can you give a minimal example of how to reproduce the problem? I'll look into it and fix it then.


I'm working on the KDevelop IDE.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]