0

I am trying to make an exe file from my python script and when I run the exe created by cx_Freeze I get the following error,

Traceback (most recent call last):
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Scripts\ScheduleThread.py", line 28, in run
    schedule.run_pending()
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\schedule\__init__.py", line 563, in run_pending
    default_scheduler.run_pending()
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\schedule\__init__.py", line 94, in run_pending
    self._run_job(job)
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\schedule\__init__.py", line 147, in _run_job
    ret = job.run()
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\schedule\__init__.py", line 466, in run
    ret = self.job_func()
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Scripts\MainUpdater.py", line 14, in MainUpdater
    Scrapper(dir_path, subreddit_name)
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Scripts\Scrapper.py", line 2, in Scrapper
    import praw
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\praw\__init__.py", line 14, in <module>
    from .reddit import Reddit  # NOQA
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\praw\reddit.py", line 11, in <module>
    from prawcore import (Authorizer, DeviceIDAuthorizer, ReadOnlyAuthorizer,
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\prawcore\__init__.py", line 4, in <module>
    from .auth import (Authorizer, DeviceIDAuthorizer, ReadOnlyAuthorizer,  # NOQA
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\prawcore\auth.py", line 5, in <module>
    from requests import Request
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\urllib3\__init__.py", line 8, in <module>
    from .connectionpool import (
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Wallpaper-Updater_venv\lib\site-packages\urllib3\connectionpool.py", line 28, in <module>
    from .packages.six.moves import queue
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Scripts\build\exe.win-amd64-3.7\lib\urllib3\packages\six.py", line 92, in __get__
    result = self._resolve()
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Scripts\build\exe.win-amd64-3.7\lib\urllib3\packages\six.py", line 115, in _resolve
    return _import_module(self.mod)
  File "C:\MS_Notes\my_scripts\Wallpaper-Updater\Scripts\build\exe.win-amd64-3.7\lib\urllib3\packages\six.py", line 82, in _import_module
    __import__(name)
ModuleNotFoundError: No module named 'queue'

This is my setup.py file,

from cx_Freeze import setup, Executable

base = None
includefiles = ["wallpaper_updater_2XT_icon.ico"]

executables = Executable(
    script="WallpaperUpdater.py",
    base=base,
    icon="wallpaper_updater_2XT_icon.ico"
)

packages = ["idna"]
options = {
    'build_exe':
    {
        'packages': packages,
        'include_files': includefiles
    },
}

setup(
    name="Wallpaper Updater",
    options=options,
    version="0.1",
    description='Downloads top images form subreddits and change wallpaper',
    executables=[executables]
)

And also I have tried using pyinstaller as well, but there is an issue with praw, where I get the following error,

Traceback (most recent call last):
  File "Scripts\ScheduleThread.py", line 28, in run
  File "site-packages\schedule\__init__.py", line 563, in run_pending
  File "site-packages\schedule\__init__.py", line 94, in run_pending
  File "site-packages\schedule\__init__.py", line 147, in _run_job
  File "site-packages\schedule\__init__.py", line 466, in run
  File "Scripts\MainUpdater.py", line 14, in MainUpdater
  File "Scripts\Scrapper.py", line 8, in Scrapper
  File "Scripts\RefreshTokenGen.py", line 75, in RefreshToken
  File "Scripts\RefreshTokenGen.py", line 49, in main
  File "site-packages\praw\reddit.py", line 129, in __init__
  File "site-packages\praw\config.py", line 72, in __init__
  File "site-packages\praw\config.py", line 98, in _initialize_attributes
  File "site-packages\praw\config.py", line 31, in _config_boolean
AttributeError: '_NotSet' object has no attribute 'lower'

Apparantly this is because of pyinstaller not able to prefectly make a .py into a .exe which can be fixed by changing the praw script, which I am not sure how to do as the guy who answered that here has not mentioned how to do, but I have contacted him about that.

If someone could help me with any sort of help, I would greatly appreciate it. Thank you in advance.

Vinay Bharadhwaj
  • 165
  • 1
  • 17
  • I did see that but the issue here is I am not importing requests, it is done by praw – Vinay Bharadhwaj Feb 25 '19 at 08:18
  • The [accepted answer](https://stackoverflow.com/q/40768570/8516269) of https://stackoverflow.com/q/40768570/8516269 or its comment should solve your problem. – jpeg Feb 25 '19 at 08:19
  • 1
    It should not matter. Using `packages = ["idna", "requests", "multiprocessing"]` should work. – jpeg Feb 25 '19 at 08:21
  • Please also note that `cx_Freeze` has a currently a bug with Python 3.7 which needs to be patched, see [Cx_freeze crashing Python3.7.0](https://stackoverflow.com/q/51314105/8516269). – jpeg Feb 25 '19 at 08:23

0 Answers0