Python Forum

Full Version: Exporting Python Output to Notepad
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 ?
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?
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....
Okay, then what exactly are device1 and instatus? If they are the wrong type that could be interfering with the write command.
i was returning the output to list before it was getting written in .txt..fixed that.. thanks