I'm trying to use pyinstaller -F --key="123456" my.py to encrypt exe, but got this error instead:
And here is the content of my.py, no extra files or datas needed:
import requests
from bs4 import BeautifulSoup
def get_page_source(page_num):
print('Crawling page %d' % page_num)
url = 'http://books.toscrape.com/catalogue/page-%d.html' % page_num
r = requests.get(url)
return r.text
def get_book_info(page_source):
soup = BeautifulSoup(page_source, features='lxml')
titles = soup.select('h3 > a')
for title in titles:
print(title.get('title'))
if __name__ == '__main__':
# 1-50
for i in range(1, 51):
page_source = get_page_source(i)
get_book_info(page_source)
Don't have any clue on how to solve it. It works fine when I stop using --key command.
PyInstaller==3.4 Python==3.6
It is known bug and it is because Pyinstaller encryption is not compatible with pycryptodome. So you need to install the old PyCrypto to make it work.
There is a good answer in here for installing the old PyCrypto
.
pip install pycrypto