Python Forum

Full Version: eric6 IDE no output into text file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I read in, reformat, and output a text file from the command line, but if I execute the same code in the eric6 IDE it produces an empty output file.

From a complete Python newbie, albeit ex-IT professional
It would help us to help you if you provided:
  • Code that reproduces the issue
  • The code in code tags
  • The code should be minimal (usually can be just 5-10 lines)
  • Example input if important for running the code
All that said, I'm not familiar with eric6, so it would probably good to give further details on that as well.
Trying to reduce the code to the minimum has narrowed down the problem. When using eric6, it works if the program is left to run, but as soon as soon as I put in debugging breaks the output file is empty.
As I was familiar with for example Visual Studio, I decided to usee an IDE , and chose ERIC6, which seems to be the recommended one.
def jsonconvert() :
    fw = open('C:\\Users\\Dave Q\\Documents\\test.json', 'w')
    fw.write('Output')
    fw.close

jsonconvert()
(Mar-22-2019, 09:38 PM)daveq Wrote: [ -> ]and chose ERIC6, which seems to be the recommended one.
That's not right VS Code and PyCharm is editors that much more used in Python.
Python extension has 34,892,370 downloads.
My tutorial VS Code from start,has nothing to with Visual Studio.
You need to call the close function. So not
fw.close
but rather
fw.close()
OK, thanks. Works now. Clearly I am still a Python baby!