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
18688
Karma
83
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
628
Karma
4
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: apater, Baidu [Spider], Bing [Bot], Exabot [Bot], Google [Bot], Majestic-12 [Bot], mmistretta, MSNbot Media, onesandzeros, shmerl, Uri_Herrera, Yahoo [Bot]