Python Forum
eric6 IDE no output into text file - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: eric6 IDE no output into text file (/thread-16971.html)



eric6 IDE no output into text file - daveq - Mar-22-2019

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


RE: eric6 IDE no output into text file - micseydel - Mar-22-2019

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.


RE: eric6 IDE no output into text file - daveq - Mar-22-2019

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()



RE: eric6 IDE no output into text file - snippsat - Mar-22-2019

(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.


RE: eric6 IDE no output into text file - micseydel - Mar-22-2019

You need to call the close function. So not
fw.close
but rather
fw.close()



RE: eric6 IDE no output into text file - daveq - Mar-22-2019

OK, thanks. Works now. Clearly I am still a Python baby!