Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Exporting Python Output to Notepad
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?
buran likes this post
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

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.
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

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

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Exporting data from python into excel Zankawah 5 220 Jun-02-2020, 03:17 AM
Last Post: buran
  Variable from notepad problem samuelbachorik 2 199 Apr-10-2020, 09:04 AM
Last Post: samuelbachorik
  Exporting list with dictionary to Excel veromi22 0 353 Oct-15-2019, 12:54 AM
Last Post: veromi22
  Exporting to Excel Nirmal 5 577 Aug-08-2019, 12:22 PM
Last Post: Nirmal
  Running python code meant for Notepad++ plugin independently greektranslator 3 658 Jan-28-2019, 06:03 PM
Last Post: maxtimbo
  Exporting Json events to a text file uklipse 3 704 Aug-21-2018, 02:12 PM
Last Post: buran
  Is there an equivalent of Notepad in linux sylas 5 1,129 Jun-15-2018, 12:33 PM
Last Post: DeaD_EyE
  Setup Notepad++ for python LavaCreeperKing 6 8,173 Mar-22-2018, 07:27 PM
Last Post: LavaCreeperKing
  With Notepad how to have lines numbered sylas 3 1,153 Mar-10-2018, 08:25 AM
Last Post: sylas
  Get filepath to save from notepad.exe python3 Jason2024 1 1,290 Oct-03-2017, 02:30 PM
Last Post: sparkz_alot

Forum Jump:

Users browsing this thread: 1 Guest(s)