• cvp

    @resserone13 sorry, didn't know 😢

    posted in Pythonista read more
  • cvp

    @resserone13 Personnally, I use this kind of code to analyze .csv file

    import csv
    from io import StringIO
    with open('xxxx.csv', mode=r'rb') as fil:
        b = fil.read()                                      # file in bytes
        b = b.decode()                                      # bytes -> str
        i_lf = 0
        j_lf = b.find('\r\n',i_lf)
        while i_lf < (len(b)-1):
            recinp = b[i_lf:j_lf]
            #print(recinp)
            i_lf = j_lf + 2                                 # 1er char after \n (\r\n = 2 chars)
            j_lf = b.find('\r\n',i_lf)
            if j_lf == -1:
                j_lf = len(b)                                   # simulate \n after last char
                
            # use csv module to split only one string
            flds_lines = csv.reader(StringIO(recinp),delimiter=',',quotechar='"')
            for fldsinp in flds_lines:
                print(fldsinp)
    
    

    posted in Pythonista read more
  • cvp

    @resserone13 said:

    with open('US_state_populations.csv', 'r'):

    #iterates over the file.
    for Line in f:
    #c = f.readline().strip().split(',')

    Seems to be erroneous code, should be like (not tested)

    with open('US_state_populations.csv', 'rt') as fil:
       f = fil.read().split('\n')
       #iterates over the file. 
       for Line in f:
            c = f.strip().split(',')
    

    posted in Pythonista read more
  • cvp

    @resserone13 said:

    im using a windows laptop.

    Ho, it is not a Pythonista problem?

    posted in Pythonista read more
  • cvp

    @resserone13 could occur if files are in an iCloud folder and that the .csv is not downloaded

    posted in Pythonista read more
  • cvp

    @halloleooo HEIC gives 2 photos..., try this with your double photo, the 2nd one is HEIC

    Edit : if you want to avoid HEIC photos, go in Settings/Camera/Formats/Most Compatible

    import ui
    
    import appex
    
    class MyView(ui.View):
        def __init__(self):
            iv = ui.ImageView(name='iv')
            iv.frame = self.bounds
            self.add_subview(iv)
        def will_close(self):
            appex.finish()
            
    def main():
        v = MyView()
        v.present()
        f = appex.get_attachments()
        n = ''
        for fil in f:
            i = fil.rfind('/')
            n += fil[i+1:]+'  '
        v.name = n
        v['iv'].image = ui.Image.named(appex.get_attachments()[0])
    
    if __name__ == '__main__':
        main()
    

    posted in Pythonista read more
  • cvp

    @halloleooo this little script prints 1 for an unique photo and 2 if 2 photos shared

    import ui
    
    import appex
    
    class MyView(ui.View):
        def __init__(self):
            pass
        def will_close(self):
            appex.finish()
            
    def main():
        v = MyView()
        v.present()
        f = appex.get_images(image_type='ui')
        print(len(f))
            
    if __name__ == '__main__':
        main()
    

    posted in Pythonista read more
  • cvp

    @halloleooo As your script process a join of two images, are you 100% sure it is not a bug?

    posted in Pythonista read more
  • cvp

    @halloleooo do you have the same problem with pil image?

    posted in Pythonista read more
  • cvp

    @halloleooo is it ok?

    posted in Pythonista read more
  • cvp

    @halloleooo so easy 😀 (or I didn't understand the question)

    import ui
    
    import appex
    
    class MyView(ui.View):
        def __init__(self):
            pass
        def will_close(self):
            appex.finish()
            
    def main():
        v = MyView()
        v.present()
            
    if __name__ == '__main__':
        main()
    

    posted in Pythonista read more
  • cvp

    @mikael Perhaps but I don't know anything about eventual OneDrive API

    posted in Pythonista read more
  • cvp

    @RocketBlaster05 try

     image = ui.Image.named('path').with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
    

    posted in Pythonista read more
  • cvp

    @ccc @develobile, Pyto's developer, didn't come here for 10 months

    posted in Pythonista read more
  • cvp

    @ccc sorry, I don't understand how to add a new pull request, no issue possible?

    posted in Pythonista read more
  • cvp

    @ccc thanks, I'll do it but I have even sent an email to tHe official support, without any acknowledgement

    posted in Pythonista read more
  • cvp

    @ccc said:

    Pyto might be a better way

    Agree but support does not answer at all and discord/Reddit forums are a lot less active than here.

    posted in Pythonista read more
  • cvp

    @JonB good idea. @satsuki-kojima you could try

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!