Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Saving “ Marks To File Using TextView
-
TextView - Saving TextView text to a file. Cannot save when text contains a “ quotation mark. All other normal characters can be saved.
def SAVE_SCOPEB(sender): jf.open(“Note_Data.py”, ‘w’) jf.write(JWriteNote.text) jf.close()
The above function works and saves text to a disk file on cloud, but when a quotation mark is part of the text, the following message is received - ‘ascii’ codec, can’t encode, characters in positions 0-1: ordina....
My first post, Thank you in advance.d
-
@James007 this works(see 'wt')
import ui v = ui.View() v.frame = (0,0,400,400) JWriteNote = ui.TextField(name ='JWriteNote') JWriteNote.frame = (10,10,200,32) v.add_subview(JWriteNote) b = ui.ButtonItem() b.title = 'save' def SAVE_SCOPEB(sender): with open('Note_Data.py', 'wt') as jf: jf.write(JWriteNote.text) b.action = SAVE_SCOPEB v.right_button_items = (b,) v.present('sheet')
-
Thanks CVP, I will give it a try ....