Difference between revisions of "Python"

From Mesopoly 3.0
Jump to navigation Jump to search
m
 
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
*http://www.vogella.de/articles/Python/article.html // pydev
 
*http://www.vogella.de/articles/Python/article.html // pydev
 +
===PyDev configuration===
 +
*http://lukeplant.me.uk/blog/posts/eclipse-pydev-and-virtualenv/ to work with source in original directory etc
 +
===PyDev does not find file===
 +
PyDev does not find file to open, even it is in the same directory as script. Reports <b>IOError: [Errno 2] No such file or directory: .. </b> in console.
 +
 +
import os
 +
fpp = os.path.join(os.path.abspath(os.curdir),'f.txt')
 +
fp = open(fpp)
 +
texti = fp.read()
 +
fp.close()
 +
print texti

Latest revision as of 10:38, 26 September 2010

PyDev configuration

PyDev does not find file

PyDev does not find file to open, even it is in the same directory as script. Reports IOError: [Errno 2] No such file or directory: .. in console.

import os
fpp = os.path.join(os.path.abspath(os.curdir),'f.txt')
fp = open(fpp)
texti = fp.read()
fp.close()
print texti