Reply to topic

error message in debug when using relative path in python

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
19743
Karma
85
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.


System Settings and Device Actions KCM maintainer
Image
User avatar scummos
KDE Developer
Posts
773
Karma
5
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.



 
Reply to topic

Bookmarks



Who is online

Registered users: andeon, awill, Baidu [Spider], Bing [Bot], davidemme, erivers, Google [Bot], google01103, jstaniek, kdeuserk, koriun, kowalskiB, La Ninje, M4he, malabiba, MSNbot Media, rv8ter, siegmundwolf, Steve Guilford, TheraHedwig, tokiedian, veqz, weholl, YaCy [Bot], Yahoo [Bot]