1

I have written a very simple program in Python 3.3, to delete some text from some files (several thousand).

When running it in the IDE, I get all the expected output in the interface. The compiled program doesn't print anything to the command line, but it does make the required changes to the files however.

Is this a problem with my code (below) or the configuration?

import os
import sys

filenames = os.listdir("XML")
print (len(filenames))

i = 0

for i in range (len(filenames)):

    pathname = os.path.join("XML", filenames[i])
    print (pathname)

    fin = open(pathname, 'r')
    lines = fin.read()
    mediauri1 = lines.find("<mpeg7:MediaUri>")
    mediauri2 = lines.find("http://",mediauri1)

    fin.close()

    fout = open(pathname, 'w+')
    lines = lines.replace(lines [mediauri1+16:mediauri2], "")
    fout.write(lines)
    fout.close()

    i = i+1
Jon Clements
  • 138,671
  • 33
  • 247
  • 280
Nick
  • 141
  • 11
  • I agree it is a duplicate. It prints the items so fast that it opens and closes before you can see it. If you don't think that this is the case, could you please post your `setup.py` file? – Anthony Jan 15 '14 at 23:48

0 Answers0