2

I am start using Sublime Text 2 and REPL and got some problems. When I run the file it tells me that the file du not exist. The script works perfect if it is build directly from the terminal.

Code

def stopwords(text):
    with open('danish', 'rU') as f:
        for line in f:
            text = text.replace(' '+line.strip()+' ', "")
    return text

Log

IOError: [Errno 2] No such file or directory: 'danish'

i have tried things like os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) reload(sys) and __file__ but they do not work.

Any ideas why __file__ don't work when running through Sublime Text 2 REPL or what where the file are stored??

boje
  • 869
  • 1
  • 16
  • 34

0 Answers0