Python Forum
Exporting Python Output to Notepad - 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: Exporting Python Output to Notepad (/thread-12510.html)



Exporting Python Output to Notepad - Nirmal - Aug-28-2018

Hi
i am trying create a file in Python 2.6.6. Its working in Python 2.7

fp = open('command_file.txt', 'w')
fp.write(device1 + '#' + intstatus + '\n' + device1 + '#\n')

command_file.txt is not being created when i run in Python 2.6.6 . any idea how to fix it up ?


RE: Exporting Python Output to Notepad - ichabod801 - Aug-28-2018

I don't see anything obvious wrong, but more information would be helpful. What are device1 and intstatus? Are you getting an error, or is there just no file? If you're getting an error, what is the full text of the error? Are you running it exactly the same in the two versions (that is, could the current working directory be different, so that the relative file path is pointing to an unexpected location?


RE: Exporting Python Output to Notepad - Nirmal - Aug-28-2018

i m not getting any error..but i dont see that file.Running exactly the same code and i am login to root... i tried

10:57:03 # find . -name command_file.txt

no luck....


RE: Exporting Python Output to Notepad - ichabod801 - Aug-29-2018

Okay, then what exactly are device1 and instatus? If they are the wrong type that could be interfering with the write command.


RE: Exporting Python Output to Notepad - Nirmal - Sep-02-2018

i was returning the output to list before it was getting written in .txt..fixed that.. thanks