Forum Archive

Old bugs

JonB

Sorry for creating another thread... this is basically an extension of the 160xx thread, but nodebb got painfully slow for me on page 50 or whatever thatbthread has become.

Instead of manually testing each bug on that list for each release, I created a simple doctest listing the bugs, with reproducible code examples.
https://github.com/jsbain/pythonista_test.git

JonB
Pythonista version 2.0.1 (201004) on iOS 8.4.1 on a 32-bit iPad3,3 with a screen size of (1024 x 768) * 2
**********************************************************************
File "test_bugs.md", line 35, in test_bugs.md
Failed example:
    ui.convert_point((10,0), v,None)-ui.convert_point((0,0), v,None)
Expected:
    Point(10.00, 0.00)
Got:
    Point(-20.00, 0.00)
**********************************************************************
File "test_bugs.md", line 37, in test_bugs.md
Failed example:
    ui.convert_point((0,10),v,None)-ui.convert_point((0,0), v,None)
Expected:
    Point(0.00, 10.00)
Got:
    Point(0.00, -20.00)
**********************************************************************
File "test_bugs.md", line 86, in test_bugs.md
Failed example:
    v.on_screen
Expected:
    False
Got:
    True
**********************************************************************
File "test_bugs.md", line 113, in test_bugs.md
Failed example:
    v.present('popover',popover_location=ui.Point(0,0))
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/755AF6FE-A598-46B0-B189-7C6BAD0391A1/Pythonista.app/Frameworks/PythonistaKit.framework/pylib/doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest test_bugs.md[50]>", line 1, in <module>
        v.present('popover',popover_location=ui.Point(0,0))
    TypeError: Expected a tuple
**********************************************************************
File "test_bugs.md", line 128, in test_bugs.md
Failed example:
    v.touch_enabled
Expected:
    False
Got:
    True
**********************************************************************
File "test_bugs.md", line 150, in test_bugs.md
Failed example:
    open(tmpfile.name).read()
Expected:
    'b\n'
Got:
    'b'
**********************************************************************
File "test_bugs.md", line 162, in test_bugs.md
Failed example:
    v.flex
Expected:
    'H'
Got:
    ''
**********************************************************************
File "test_bugs.md", line 164, in test_bugs.md
Failed example:
    v.frame
Expected:
    Rect(0.00, 0.00, 200.00, 200.00)
Got:
    Rect(0.00, 0.00, 100.00, 100.00)
**********************************************************************
File "test_bugs.md", line 173, in test_bugs.md
Failed example:
    scene.ShapeNode() #doctest:+ELLIPSIS
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/755AF6FE-A598-46B0-B189-7C6BAD0391A1/Pythonista.app/Frameworks/PythonistaKit.framework/pylib/doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest test_bugs.md[75]>", line 1, in <module>
        scene.ShapeNode() #doctest:+ELLIPSIS
      File "/var/mobile/Containers/Bundle/Application/755AF6FE-A598-46B0-B189-7C6BAD0391A1/Pythonista.app/Frameworks/PythonistaKit.framework/pylib_ext/scene.py", line 287, in __init__
        self.line_width = path.line_width
    AttributeError: 'NoneType' object has no attribute 'line_width'
**********************************************************************
File "test_bugs.md", line 184, in test_bugs.md
Failed example:
    scene.SpriteNode(texture=None,color=(0,1,1)) #doctest:+ELLIPSIS
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/755AF6FE-A598-46B0-B189-7C6BAD0391A1/Pythonista.app/Frameworks/PythonistaKit.framework/pylib/doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest test_bugs.md[76]>", line 1, in <module>
        scene.SpriteNode(texture=None,color=(0,1,1)) #doctest:+ELLIPSIS
    TypeError: expected a Texture or image name
**********************************************************************
File "test_bugs.md", line 195, in test_bugs.md
Failed example:
    abs(r.inset(0,10).width)
Expected:
    80.0
Got:
    120.0
**********************************************************************
File "test_bugs.md", line 209, in test_bugs.md
Failed example:
    r==r.translate(0,0) #fails
Expected:
    True
Got:
    False
**********************************************************************
1items had failures:
  13 of  83 in test_bugs.md
***Test Failed***13failures.
TestResults(failed=13, attempted=83)
JonB

and in 3.x

Pythonista version 3.0 (300003) on iOS 8.4.1 on a 32-bit iPad3,3 with a screen size of (1024 x 768) * 2
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 11, in test_bugs.md
Failed example:
    ui.convert_point((10,0), v,None)-ui.convert_point((0,0), v,None)
Expected:
    Point(10.00, 0.00)
Got:
    Point(-20.00, 0.00)
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 13, in test_bugs.md
Failed example:
    ui.convert_point((0,10),v,None)-ui.convert_point((0,0), v,None)
Expected:
    Point(0.00, 10.00)
Got:
    Point(0.00, -20.00)
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 53, in test_bugs.md
Failed example:
    v.on_screen
Expected:
    False
Got:
    True
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 72, in test_bugs.md
Failed example:
    v.present('popover',popover_location=ui.Point(0,0))
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[42]>", line 1, in <module>
        v.present('popover',popover_location=ui.Point(0,0))
    TypeError: Expected a tuple
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 76, in test_bugs.md
Failed example:
    class CustomView(ui.View):
        def __init__(self)
                pass
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[44]>", line 2
        def __init__(self)
                         ^
    SyntaxError: invalid syntax
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 79, in test_bugs.md
Failed example:
    v=CustomView()
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[45]>", line 1, in <module>
        v=CustomView()
    NameError: name 'CustomView' is not defined
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 83, in test_bugs.md
Failed example:
    v.touch_enabled
Expected:
    False
Got:
    True
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 90, in test_bugs.md
Failed example:
    with open(tmpfile,'w') as f:
        f.write('a\n')
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[51]>", line 1, in <module>
        with open(tmpfile,'w') as f:
    TypeError: invalid file: <tempfile._TemporaryFileWrapper object at 0x16cddcbc>
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/objc_util.py", line 875, in OMMainThreadDispatcher_invoke_imp
    retval = func(*args, **kwargs)
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/editor.py", line 128, in open_file
    if not path.startswith('/'):
UnboundLocalError: local variable 'path' referenced before assignment
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/objc_util.py", line 875, in OMMainThreadDispatcher_invoke_imp
    retval = func(*args, **kwargs)
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/editor.py", line 128, in open_file
    if not path.startswith('/'):
UnboundLocalError: local variable 'path' referenced before assignment
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 99, in test_bugs.md
Failed example:
    open(tmpfile.read()
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[59]>", line 1
        open(tmpfile.read()
                          ^
    SyntaxError: unexpected EOF while parsing
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 104, in test_bugs.md
Failed example:
    v.flex
Expected:
    'H'
Got:
    ''
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 106, in test_bugs.md
Failed example:
    v.frame
Expected:
    Rect(0.00, 0.00, 200.00, 200.00)
Got:
    Rect(0.00, 0.00, 100.00, 100.00)
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 138, in test_bugs.md
Failed example:
    scene.ShapeNode()
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[76]>", line 1, in <module>
        scene.ShapeNode()
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/scene.py", line 293, in __init__
        self.line_width = path.line_width
    AttributeError: 'NoneType' object has no attribute 'line_width'
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 142, in test_bugs.md
Failed example:
    abs(r.inset(0,10).width)
Expected:
    80.0
Got:
    120.0
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 147, in test_bugs.md
Failed example:
    r==r.translate(0,0)
Expected:
    True
Got:
    False
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/test_bugs.md", line 151, in test_bugs.md
Failed example:
    r==r.translate(0,0)
Expected:
    True
Got:
    False
**********************************************************************
1 items had failures:
  16 of  83 in test_bugs.md
***Test Failed*** 16 failures.
TestResults(failed=16, attempted=83)
omz

Thanks for putting this together. I'll see how many of them I can squash.

JonB

and the same in 3.x, though with some errors found in the nee editor module

   Pythonista version 3.0 (300003) on iOS 8.4.1 on a 32-bit iPad3,3 with a screen size of (1024 x 768) * 2
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 35, in test_bugs.md
Failed example:
    ui.convert_point((10,0), v,None)-ui.convert_point((0,0), v,None)
Expected:
    Point(10.00, 0.00)
Got:
    Point(-20.00, 0.00)
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 37, in test_bugs.md
Failed example:
    ui.convert_point((0,10),v,None)-ui.convert_point((0,0), v,None)
Expected:
    Point(0.00, 10.00)
Got:
    Point(0.00, -20.00)
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 86, in test_bugs.md
Failed example:
    v.on_screen
Expected:
    False
Got:
    True
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 113, in test_bugs.md
Failed example:
    v.present('popover',popover_location=ui.Point(0,0))
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[50]>", line 1, in <module>
        v.present('popover',popover_location=ui.Point(0,0))
    TypeError: Expected a tuple
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 128, in test_bugs.md
Failed example:
    v.touch_enabled
Expected:
    False
Got:
    True
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 139, in test_bugs.md
Failed example:
    with tmpfile as f:
        f.write('a\n')
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[60]>", line 2, in <module>
        f.write('a\n')
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/tempfile.py", line 484, in func_wrapper
        return func(*args, **kwargs)
    TypeError: a bytes-like object is required, not 'str'
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/objc_util.py", line 875, in OMMainThreadDispatcher_invoke_imp
    retval = func(*args, **kwargs)
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/editor.py", line 128, in open_file
    if not path.startswith('/'):
UnboundLocalError: local variable 'path' referenced before assignment
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/objc_util.py", line 875, in OMMainThreadDispatcher_invoke_imp
    retval = func(*args, **kwargs)
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/editor.py", line 128, in open_file
    if not path.startswith('/'):
UnboundLocalError: local variable 'path' referenced before assignment
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 150, in test_bugs.md
Failed example:
    open(tmpfile.name).read()
Expected:
    'b\n'
Got:
    ''
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/objc_util.py", line 875, in OMMainThreadDispatcher_invoke_imp
    retval = func(*args, **kwargs)
  File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/editor.py", line 128, in open_file
    if not path.startswith('/'):
UnboundLocalError: local variable 'path' referenced before assignment
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 162, in test_bugs.md
Failed example:
    v.flex
Expected:
    'H'
Got:
    ''
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 164, in test_bugs.md
Failed example:
    v.frame
Expected:
    Rect(0.00, 0.00, 200.00, 200.00)
Got:
    Rect(0.00, 0.00, 100.00, 100.00)
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 173, in test_bugs.md
Failed example:
    scene.ShapeNode() #doctest:+ELLIPSIS
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[75]>", line 1, in <module>
        scene.ShapeNode() #doctest:+ELLIPSIS
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/scene.py", line 293, in __init__
        self.line_width = path.line_width
    AttributeError: 'NoneType' object has no attribute 'line_width'
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 184, in test_bugs.md
Failed example:
    scene.SpriteNode(texture=None,color=(0,1,1)) #doctest:+ELLIPSIS
Exception raised:
    Traceback (most recent call last):
      File "/var/mobile/Containers/Bundle/Application/0AA728A2-9F29-44AB-8980-8C236203F6C2/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest test_bugs.md[76]>", line 1, in <module>
        scene.SpriteNode(texture=None,color=(0,1,1)) #doctest:+ELLIPSIS
    TypeError: expected a Texture or image name
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 195, in test_bugs.md
Failed example:
    abs(r.inset(0,10).width)
Expected:
    80.0
Got:
    120.0
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 205, in test_bugs.md
Failed example:
    r==r.translate(0,0) # works
Expected:
    True
Got:
    False
**********************************************************************
File "/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/pythonistatest/test_bugs.md", line 209, in test_bugs.md
Failed example:
    r==r.translate(0,0) #fails
Expected:
    True
Got:
    False
**********************************************************************
1 items had failures:
  15 of  83 in test_bugs.md
***Test Failed*** 15 failures
omz

So far, I'm down from 12 failures to 10 (fixed popover_location not accepting a ui.Point and closing panel views not being possible).

One thing I've noticed is that your method of getting the app's version fails for my development build. The reason seems to be that Xcode is optimizing the Info.plist by saving it in the binary plist format, which plistlib can't handle. I assume that this is somehow not the case for the App Store build, but you might not want to rely on that. Just for fun, I've just written a new pythonista_version() function that is, quite honestly, total overkill, but should be able to detect the correct version number for absolutely any version of Pythonista that has ever existed:

def pythonista_version():
    try:
        # Try reading Info.plist using plistlib; could fail if Info.plist is binary
        plist = plistlib.readPlist(os.path.abspath(os.path.join(sys.executable, '..', 'Info.plist')))
        return '{CFBundleShortVersionString} ({CFBundleVersion})'.format(**plist)
    except:
        try:
            # Use objc_util to access Info.plist via native APIs; will fail for versions < 2.0 (objc_util/ctypes weren't available)
            from objc_util import NSBundle
            return str(NSBundle.mainBundle().infoDictionary()['CFBundleShortVersionString'])
        except ImportError:
            # For older versions (1.x), determine the version by checking for capabilities (modules that were added)
            version = None
            try:
                import ui
                version = '1.5'
            except ImportError:
                pass
            if not version:
                try:
                    import contacts
                    version = '1.4'
                except ImportError:
                    pass
            if not version:
                try:
                    import photos
                    version = '1.3'
                except ImportError:
                    pass
            if not version:
                try:
                    import PIL
                    version = '1.2'
                except ImportError:
                    pass
            if not version:
                try:
                    import editor
                    version = '1.1'
                except ImportError:
                    pass
            if not version:
                version = '1.0'
            return version
omz

Correction: 9 failures (one thing failed because I incorrectly reformatted the doctest).

omz

Speaking of doctest formatting: Pythonista supports syntax-highlighting for code blocks that are embedded in Markdown files. You'll just have to add python to the first triple-backticks.

```python
# python code will be syntax-highlighted here...
```
omz

I've managed to make all tests pass in 2.0.1 (haven't tested in 3.0 yet, but should theoretically also work because the affected code is shared).

I've not actually encountered any failures related to convert_point, so I haven't changed anything there, not sure why these tests would fail for you (I've tested on an iPad Air 2, I think I'll also have to check this on an iPhone and perhaps a non-retina iPad).

omz

@JonB Also, thanks for giving me the idea for a new feature (see next beta). :)

JonB

wow that was quick! thanks!

did the convert_point tests pass?

I am using ipad3, which i believe is retina, but also 32 bit... this might be orientation dependant, as I recall from earlier experiments back in 1.5, I think the corner of the ipad used as the origin was not the upper left of the current orientation, but instead a fixed corner. Though this may be a little different than the 1.5x issues -- there, convert_point only failed in fullscreen. Here it seems to fail for all present types.

omz

I'm seeing only one failure here with the latest P3 beta, but that's related to a Python 3 change – f.write('a\n') fails because the file is open in binary mode and write expects a bytes object and not unicode.

If you're still seeing other tests fail on your device, could you post the output here?

omz

I just noticed that one convert_point test fails if the keyboard is visible when the test is started.

JonB

I posted a simpler convert point doctest to the github repo.

In 1.5, the origin was wrong when converting fullscreen views using a None argument. i think it was lcked to the lower right corner. Now fullscreen has the origin priblem, and also all views have scaling problems, at least on ipad 3.

JonB

also, view.close() doesn't seem to work still for panel. I thought it did the first time, but now it doesn't. manually closing the view crashes P3.

ywangd

I am having same issue on closing panel view as @JonB

The first time it worked (programmatically closed a panel view of stash). The I added some print statements in will_close() method to check whether it is fired. Somehow the print statements caused the system to issue a KeyboardInterrupt exception and prevented it from working. Then I manually closed the panel view by tapping the X button. This crashes the app and this becomes permanent. Now it crashes everytime I try to manually close a panel view. I have tried restart the app and even the device. It still persists ...

ywangd

In fact, manually closing a panel view just crashes the app no matter what. I installed the latest Pythonista 3 beta on my other device and it crashed straight away.

dgelessus

I can confirm that closing a panel view manually crashes the app. Closing the view programmatically works for me though (testing with filenav on Pythonista 3).

Tizzy

I think the twitter module in pythonista 2 isn't quite right -> either that or I'm missing something.

No matter what I do, I can't get the results from this advanced twitter search:
https://twitter.com/search?q=Privacy%20OR%20Apple%20from%3ARepTedLieu&src=typd

The terms of the search being (( Privacy OR Apple ) from:RepTedLieu )

I tried passing it in as the regular search query parameter as well as {"q":"query"} parameter.

import twitter

def performPrivacySearch(self):

    parameters = {'q':"Privacy%20OR%20Apple%20from%3ARepTedLieu&src=typd",'result_type':'mixed'}

    #Tried all these:
    #queryURL = "privacy, apple from:reptedlieu"
    #queryURL= "Privacy%20OR%20Apple%20from%3ARepTedLieu&src=typd"
    data = twitter.search(self.account,queryURL,count=2,parameters=parameters)


    for each in range(len(data["statuses"])):

    print("\n")
    print "=====> "+str(each)
    print(">user: "+str(data["statuses"][each]["user"]["screen_name"]))
    print data["statuses"][each]["text"]
    print("________________________>")

Thoughts anyone?

omz

@JonB @dgelessus @ywangd I can confirm that closing panel views (both programmatically and manually) is still mostly broken, looking into it.

omz

@Tizzy This works fine for me:

import twitter
account = twitter.get_all_accounts()[0]
def perform_search():
    data = twitter.search(account, 'Privacy OR Apple from:RepTedLieu',
                          parameters={'result_type': 'mixed'})
    for status in data['statuses']:
        print '> user: ', status['user']['screen_name']
        print status['text']
        print("________________________>")

perform_search()

(I've changed the structure a bit to make it work as a standalone example.)