• jumpbeen

    @JonB said:

    out of curiosity, is file used locally, or on the server?

    Yes, It's locally.
    @TheRealBret
    You can replace older version of 'usr/bin/file' and 'usr/share/file' to fix it, if your mac os version has updated to 10.13.

    posted in Pythonista read more
  • jumpbeen

    MNFW2CH/A(iPhone 7 Plus), iOS 10.3.1.
    And i found out when the appex.get_web_page_info() return {}, the _appex.get_input() will return:

    [{'attachments': [{'com.apple.property-list': 'Error: Unknown data type: (null)'}]}]

    posted in Pythonista read more
  • jumpbeen

    Through the further testing, I found that some of web sites (such as stackoverflow.com) can return the expected results for the first run, but for the second run it always return the empty. Refresh the page will be able to return to the expected results. But other sites(such as stackoverflow.com/users/login ) can not return any results anyway.

    posted in Pythonista read more
  • jumpbeen

    Thank you. I have installed the latest beta version today. But i always get an empty dictionary every time when i call appex.get_webpage_info(). Do you know why?

    posted in Pythonista read more
  • jumpbeen

    From Apple Developer website .

    Accessing a Webpage

    In Share extensions (on both platforms) and Action extensions (iOS only), you can give users access to web content by asking Safari to run a JavaScript file and return the results to the extension. You can also use the JavaScript file to access a webpage before your extension runs (on both platforms), or to access or modify the webpage after your extension completes its task (iOS only). For example, a Share extension can help users share content from a webpage, or an Action extension in iOS might display a translation of the user’s current webpage.

    To add webpage access and manipulation to your app extension, perform the following steps:

    Create a JavaScript file that includes a global object named ExtensionPreprocessingJS. Assign a new instance of your custom JavaScript class to this object.
    In the NSExtensionActivationRule dictionary in your app extension’s Info.plist file, give the NSExtensionActivationSupportsWebPageWithMaxCount key a nonzero value. (To learn more about the activation rule dictionary, see Declaring Supported Data Types for a Share or Action Extension.)
    When your app extension starts, use the NSItemProvider class to get the results returned by the execution of the JavaScript file.
    In an iOS app extension, pass values to the JavaScript file if you want Safari to modify the webpage when your extension completes its task. (You use the NSItemProvider class in this step, too.)
    To tell Safari that your app extension includes a JavaScript file, add the NSExtensionJavaScriptPreprocessingFile key to the NSExtensionAttributes dictionary. The value of the key should be the file that you want Safari to load before your extension starts. For example:

    <key>NSExtensionAttributes</key>
            <dict>
                <key>NSExtensionJavaScriptPreprocessingFile</key>
                <string>MyJavaScriptFile</string> <!-- Do not include the ".js" filename extension -->
            </dict>
    

    posted in Pythonista read more
  • jumpbeen

    I found on the Apple Developer website as follows, I am not an iOS developer, but look at the introduction that can be achieved.

    Accessing a Webpage

    In Share extensions (on both platforms) and Action extensions (iOS only), you can give users access to web content by asking Safari to run a JavaScript file and return the results to the extension. You can also use the JavaScript file to access a webpage before your extension runs (on both platforms), or to access or modify the webpage after your extension completes its task (iOS only). For example, a Share extension can help users share content from a webpage, or an Action extension in iOS might display a translation of the user’s current webpage.

    To add webpage access and manipulation to your app extension, perform the following steps:

    Create a JavaScript file that includes a global object named ExtensionPreprocessingJS. Assign a new instance of your custom JavaScript class to this object.
    In the NSExtensionActivationRule dictionary in your app extension’s Info.plist file, give the NSExtensionActivationSupportsWebPageWithMaxCount key a nonzero value. (To learn more about the activation rule dictionary, see Declaring Supported Data Types for a Share or Action Extension.)
    When your app extension starts, use the NSItemProvider class to get the results returned by the execution of the JavaScript file.
    In an iOS app extension, pass values to the JavaScript file if you want Safari to modify the webpage when your extension completes its task. (You use the NSItemProvider class in this step, too.)
    To tell Safari that your app extension includes a JavaScript file, add the NSExtensionJavaScriptPreprocessingFile key to the NSExtensionAttributes dictionary. The value of the key should be the file that you want Safari to load before your extension starts. For example:

    <key>NSExtensionAttributes</key>
    <dict>
    <key>NSExtensionJavaScriptPreprocessingFile</key>
    <string>MyJavaScriptFile</string> <!-- Do not include the ".js" filename extension -->
    </dict>

    posted in Pythonista read more
  • jumpbeen

    I have the same problem.

    import photos
    from get_available_memory import get_free_mem
    import gc
    from PIL import Image
    photo_count = 500 
    photo_index = 0
    all_assets = photos.get_assets()
    print('Start', get_free_mem()) #Start 814.9 MB
    while photo_index < photo_count:
        ass = all_assets[photo_index]
        img_data = ass.get_image_data()
        img_data.__del__()
        del img_data
        del ass
        gc.collect()
        photo_index += 1
    del all_assets
    gc.collect()
    print('Done', get_free_mem()) #Done 165.4 MB
    

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!