omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    textview.txt saving “ marks
    3
    3
    1176
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • James007
      James007 last edited by ccc

      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

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @James007 last edited by

        @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')
        
        1 Reply Last reply Reply Quote 0
        • Jim007
          Jim007 last edited by

          Thanks CVP, I will give it a try ....

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors