type error need string or buffer, file found in python
<p>So when i write this chunk of code separately, it works fine but when i combine them together it give me typeError. Why is this happen? I don't get it when i wrote them separately it works fine. thanks in advance :)</p>

<pre><code>def printOutput(start, end, makeList):

  if start == end == None:

      return

  else:

      print start, end

      with open('OUT'+ID+'.txt','w') as outputFile:#file for result output
          for inRange in makeList[(start-1):(end-1)]:
              outputFile.write(inRange)
          with open(outputFile) as file:
              text = outputFile.read()
      with open('F'+ID+'.txt', 'w') as file:
        file.write(textwrap.fill(text, width=6))
</code></pre>
