py2app error running app
py2app error running app
macOS 10.12 Im trying to package a python script called getUrls_douyu.py as a standalone applicationexecutable without dependencies, so Im using py2app. The problem is that when I try to run my app after building from terminal with: open getUrls_douyu.app, nothing happens and I get the following error prompt: The console error: Detected missing constraints for private. It cannot be placed because there are not enough constraints to fully define the size and origin. Add the missing constraints, or set translatesAutoresizingMaskIntoConstraintsYES and constraints will be generated for you. If this view is laid out manually on macOS 10.12 and later, you may choose to not call super layout from your override. Set a breakpoint on DETECTED_MISSING_CONSTRAINTS to debug. This error will only be logged once. If I try open getUrls_douyu.appContentsMacOSgetUrls_douyu the executable inside the app bundle, I get a different error: IOError: Could not find a suitable TLS CA certificate bundle, invalid path: UsersREDACTEDgetUrls_douyudistgetUrls_douyu.appContentsResourceslibpython2.7site-packages.zipcertificacert.pem But I checked and cacert.pem does indeed exist there, so for some reason the certificate is invalid My .py script uses requests module to get stuff from a webpage which I think must be the issue. Heres my full python script: import requests from bs4 import BeautifulSoup html requests.gethttps:www.douyu.comdirectoryall.text soup BeautifulSouphtml, html.parser urls soup.select.play-list-link output ; output open json array for i, url in enumerateurls: channelName stri; channelUrl http:douyu.com url.gethref output output channelName: channelName.encodeutf-8 , output channelUrl: channelUrl.encodeutf-8 output , output output:-1 output print output When I first built this script I did so in a virtualenv within which Ive done pip install requests and pip install beautifulsoup4 and tested that the script successfully ran with no problem. This answer to a question regarding the cacert.pem error with the requests module did not help me. Here is my python script when applying that given solution: import requests from bs4 import BeautifulSoup import sys, os def override_where: overrides certifi.core.where to return actual location of cacert.pem change this to match the location of cacert.pem return os.path.abspathcacert.pem is the program compiled if hasattrsys, frozen: import certifi.core os.environREQUESTS_CA_BUNDLE override_where certifi.core.where override_where delay importing until after where has been replaced import requests.utils import requests.adapters replace these variables in case these modules were imported before we replaced certifi.core.where requests.utils.DEFAULT_CA_BUNDLE_PATH override_where requests.adapters.DEFAULT_CA_BUNDLE_PATH override_where html requests.gethttps:www.douyu.comdirectoryall.text soup BeautifulSouphtml, html.parser urls soup.select.play-list-link output ; output open json array for i, url in enumerateurls: channelName stri; channelUrl http:douyu.com url.gethref output output channelName: channelName.encodeutf-8 , output channelUrl: channelUrl.encodeutf-8 output , output output:-1 output print output I think Ive set up my py2app setup.py file correctly... from setuptools import setup APP getUrls_douyu.py DATA_FILES OPTIONS setup appAPP, data_filesDATA_FILES, optionspy2app: OPTIONS, setup_requirespy2app, Sorry for the verbose question Im new-ish to python so I imagine Ive made some dumb mistake. Any help GREATLY appreciated.
Комментарии
Отправить комментарий