realpython / reader Goto Github PK
View Code? Open in Web Editor NEWRead the latest Real Python tutorials (PyPI Demo Package)
Home Page: https://realpython.com/pypi-publish-python-package/
License: MIT License
Read the latest Real Python tutorials (PyPI Demo Package)
Home Page: https://realpython.com/pypi-publish-python-package/
License: MIT License
I was following along with the PyInstaller tutorial that goes along with this project, and I received an error.
$pyinstaller cli.py --onefile
The 'typing' package is an obsolete backport of a standard library package and is incompatible with PyInstaller. Pleaseconda remove t>yping
then try again.
I was able to use pip uninstall typing
to remove typing, and then PyInstaller was able to create the executable, but the executable fails.
Here is the traceback when I ran the executable from the command line.
$cli.exe
Traceback (most recent call last):
File "C:\Users\<user>\Downloads\Test2\reader\cli.py", line 1, in <module>
from reader.__main__ import main
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "reader\__init__.py", line 22, in <module>
File "configparser.py", line 782, in get
File "configparser.py", line 1153, in _unify_values
configparser.NoSectionError: No section: 'feed'
[244572] Failed to execute script 'cli' due to unhandled exception!
Link to PyInstaller tutorial:
https://realpython.com/pyinstaller-python/#debugging-pyinstaller-executables
Here is my environment after I removed typing
:
# packages in environment at C:\Users\<user>\Anaconda3\envs\test:
#
# Name Version Build Channel
altgraph 0.17 pyhd3eb1b0_0
bzip2 1.0.8 he774522_0
ca-certificates 2022.4.26 haa95532_0
certifi 2020.6.20 pyhd3eb1b0_3
feedparser 6.0.8 pypi_0 pypi
future 0.18.2 py310haa95532_1
html2text 2020.1.16 pypi_0 pypi
importlib-resources 5.7.1 pypi_0 pypi
libffi 3.4.2 h604cdb4_1
macholib 1.14 pyhd3eb1b0_1
openssl 1.1.1o h2bbff1b_0
pefile 2019.4.18 py_0
pip 21.2.4 py310haa95532_0
pycryptodome 3.12.0 py310h2bbff1b_0
pyinstaller 4.8 py310h8cc25b3_0
python 3.10.4 hbb2ffb3_0
pywin32 302 py310h2bbff1b_2
pywin32-ctypes 0.2.0 py310haa95532_1000
realpython-reader 1.0.0 pypi_0 pypi
setuptools 61.2.0 py310haa95532_0
sgmllib3k 1.0.0 pypi_0 pypi
sqlite 3.38.3 h2bbff1b_0
tk 8.6.11 h2bbff1b_1
tzdata 2022a hda174b7_0
vc 14.2 h21ff451_1
vs2015_runtime 14.27.29016 h5e58377_2
wheel 0.37.1 pyhd3eb1b0_0
wincertstore 0.2 py310haa95532_2
xz 5.2.5 h8cc25b3_1
zlib 1.2.12 h8cc25b3_2
I'm using Python 3.6.6 on Mac OS and see the following error when running the realpython
script:
Traceback (most recent call last):
File "/Users/durden/.virtualenvs/reader/lib/python3.6/site-packages/feedparser.py", line 398, in __getattr__
return self.__getitem__(key)
File "/Users/durden/.virtualenvs/reader/lib/python3.6/site-packages/feedparser.py", line 356, in __getitem__
return dict.__getitem__(self, key)
KeyError: 'title'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/durden/Documents/work/real_python/pyinstaller/reader/reader/__main__.py", line 84, in <module>
main()
File "/Users/durden/Documents/work/real_python/pyinstaller/reader/reader/__main__.py", line 78, in main
site = feed.get_site(url=url)
File "/Users/durden/Documents/work/real_python/pyinstaller/reader/reader/feed.py", line 25, in get_site
return u"{info.title} ({info.link})".format(info=info)
File "/Users/durden/.virtualenvs/reader/lib/python3.6/site-packages/feedparser.py", line 400, in __getattr__
raise AttributeError("object has no attribute '%s'" % key)
AttributeError: object has no attribute 'title'
Hello,
I wanted to publish my package so I found this article along with this example repository. I consider running my program locally for development purpose then publish it but I have an issue with the import statements. Either the import will be good to run it during development and break once the package is installed using $ pip install
(ModuleNotFoundError: No module named 'xxx') or the other way around (using relative path).
Is there a way or should I rename each import before packaging?
Using this repository example, what would be the way to run it directly locally? $ python reader/__main__.py
throws ModuleNotFoundError: No module named 'reader'
. Let's imagine that someone wants to extend the code, they would have to run the code locally along during the programming stage, is it possible?
Thank you.
Hello, I am trying to follow the tutorial of using pyinstaller to build executable python file. But I got the following error message
C:\Users\SDE\python\pyinstaller\reader-master>pyinstaller cli.py --add-data reader\config.cfg:reader
usage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME] [--add-data <SRC;DEST or SRC:DEST>] [--add-binary <SRC;DEST or SRC:DEST>] [-p DIR] [--hidden-import MODULENAME] [--collect-submodules MODULENAME]
[--collect-data MODULENAME] [--collect-binaries MODULENAME] [--collect-all MODULENAME] [--copy-metadata PACKAGENAME] [--recursive-copy-metadata PACKAGENAME] [--additional-hooks-dir HOOKSPATH]
[--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES] [--key KEY] [--splash IMAGE_FILE] [-d {all,imports,bootloader,noarchive}] [-s] [--noupx] [--upx-exclude FILE] [-c] [-w]
[-i <FILE.ico or FILE.exe,ID or FILE.icns or "NONE">] [--disable-windowed-traceback] [--version-file FILE] [-m <FILE or XML>] [-r RESOURCE] [--uac-admin] [--uac-uiaccess] [--win-private-assemblies]
[--win-no-prefer-redirects] [--osx-bundle-identifier BUNDLE_IDENTIFIER] [--target-architecture ARCH] [--codesign-identity IDENTITY] [--osx-entitlements-file FILENAME] [--runtime-tmpdir PATH]
[--bootloader-ignore-signals] [--distpath DIR] [--workpath WORKPATH] [-y] [--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL]
scriptname [scriptname ...]
pyinstaller: error: argument --add-data: invalid add_data_or_binary value: 'reader\\config.cfg:reader'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.