TypeError in cx-freeze exe - python

im very new so pls dont hate.
I recently built my exe from my py with cx-freeze but when i open it, it shows this :
Does anyone know how i can fix this?
module.run()
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\cx_Freeze\initscripts\Console.py", line 37, in run
exec(code, {'__name__': '__main__'})
File "Hellofresh.py", line 16, in <module>
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyfiglet\__init__.py", line 65, in figlet_format
fig = Figlet(font, **kwargs)
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyfiglet\__init__.py", line 794, in __init__
self.setFont()
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyfiglet\__init__.py", line 801, in setFont
self.Font = FigletFont(font=self.font)
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyfiglet\__init__.py", line 126, in __init__
self.data = self.preloadFont(font)
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyfiglet\__init__.py", line 136, in preloadFont
if pkg_resources.resource_exists('pyfiglet.fonts', fn):
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pkg_resources\__init__.py", line 1134, in resource_exists
return get_provider(package_or_requirement).has_resource(resource_name)
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pkg_resources\__init__.py", line 364, in get_provider
return _find_adapter(_provider_factories, loader)(module)
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pkg_resources\__init__.py", line 1392, in __init__
self.module_path = os.path.dirname(getattr(module, '__file__', ''))
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\ntpath.py", line 223, in dirname
return split(p)[0]
File "C:\Users\Jakob\AppData\Local\Programs\Python\Python38-32\lib\ntpath.py", line 185, in split
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType```

I have also faced the same problem many times.
To fix this you can uninstall XX freeze module by running the command:
pip uninstall cx_freeze
And then reinstall the module by the command:
pip install cx_freeze
Then your error might be fixed. But if it is not fixed try reinstalling the Python.

Related

A confusing Typeerror appears at the anaconda prompt

When I finished installing minicoda and opened the prompt to use CONDA list or other commands, I got a confusing Typeerror
such as:
Traceback (most recent call last):
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\exceptions.py", line 819, in __call__
return func(*args, **kwargs)
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\cli\main.py", line 74, in _main
context.__init__(argparse_args=args)
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\base\context.py", line 237, in __init__
argparse_args=argparse_args)
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\common\configuration.py", line 722, in __init__
self._set_search_path(search_path)
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\common\configuration.py", line 728, in _set_search_path
self._set_raw_data(load_file_configs(search_path))
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\common\configuration.py", line 369, in load_file_configs
raw_data = odict(kv for kv in chain.from_iterable(load_paths))
File "C:\Users\huangwei\Miniconda2\lib\collections.py", line 69, in __init__
self.__update(*args, **kwds)
File "C:\Users\huangwei\Miniconda2\lib\_abcoll.py", line 571, in update
for key, value in other:
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\common\configuration.py", line 369, in <genexpr>
raw_data = odict(kv for kv in chain.from_iterable(load_paths))
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\common\configuration.py", line 344, in _file_yaml_loader
yield fullpath, YamlRawParameter.make_raw_parameters_from_file(fullpath)
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\common\configuration.py", line 336, in make_raw_parameters_from_file
return cls.make_raw_parameters(filepath, ruamel_yaml) or EMPTY_MAP
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\common\configuration.py", line 325, in make_raw_parameters
for key in from_map)
File "C:\Users\huangwei\Miniconda2\lib\site-packages\conda\common\configuration.py", line 325, in <genexpr>
for key in from_map)
TypeError: string indices must be integers, not str
the env is below:
enter image description here
enter image description here
Is there any good solution?
Thank you!
As Merv says, if you haven't installed Minionda/Anaconda before, you can try conda update anaconda-navigator to fix this problem
but if you used to install Minionda/Anaconda and you didn't uninstall it cleanly, then you can fix this problem refer this issue

Can't install python module "pywhatkit"

So I was working on a automated whatsapp messenger and I tried to install the module known as "pywhatkit" but I am getting an error everytime.
The error trace is the following:
ERROR: Exception: Traceback (most recent call last): File
"c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\resolvelib\resolvers.py",
line 171, in _merge_into_criterion
crit = self.state.criteria[name] KeyError: 'pymsgbox'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\base_command.py", line 189, in _main
status = self.run(options, args)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\req_command.py", line 178, in wrapper
return func(self, options, args)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\install.py", line 316, in run
requirement_set = resolver.resolve(
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 121, in resolve
self._result = resolver.resolve(
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 453, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 318, in resolve
name, crit = self._merge_into_criterion(r, parent=None)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, in _merge_into_criterion
crit = Criterion.from_requirement(self._p, requirement, parent)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 82, in from_requirement
if not cands:
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 124, in __bool__
return bool(self._sequence)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in __bool__
return any(self)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 38, in _iter_built
candidate = func()
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 167, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 300, in __init__
super().__init__(
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 144, in __init__
self.dist = self._prepare()
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 226, in _prepare
dist = self._prepare_distribution()
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 311, in _prepare_distribution
return self._factory.preparer.prepare_linked_requirement(
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\operations\prepare.py", line 457, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\operations\prepare.py", line 500, in _prepare_linked_requirement
dist = _get_prepared_distribution(
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\operations\prepare.py", line 66, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\distributions\sdist.py", line 39, in prepare_distribution_metadata
self._setup_isolation(finder)
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\distributions\sdist.py", line 66, in _setup_isolation
self.req.build_env = BuildEnvironment()
File "c:\users\पज\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\build_env.py", line 83, in __init__
fp.write(textwrap.dedent(
File "c:\users\पज\appdata\local\programs\python\python38\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 148-149: character maps to <undefined>
pip install pywhatkit
If this doesn't work use
pip install pipwin
And then
pipwin install pywhatkit
If it is installed and giving error try
pip install pywhatkit --upgrade
I had the same problem. I used a lot of tricks but finally got my solution. I didn't add my python scripts directory in the path variable. C:\Users\Computer\AppData\Roaming\Python\Python310\Scripts. When I added this path to the path variable. Then pywhatkit was running on my machine. Note: I had recently reset my computer and gave it windows 10 pro!

jupyter notebook setup failed with “TypeError: __call__() takes exactly 2 arguments (1 given)”

I installed jupiter with pip and run
jupyter notebook
Then I got this mistakes:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 1136, in initialize
super(NotebookApp, self).initialize(argv)
File "<decorator-gen-6>", line 2, in initialize
File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 243, in initialize
self.migrate_config()
File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 162, in migrate_config
from .migrate import get_ipython_dir, migrate
File "/Library/Python/2.7/site-packages/jupyter_core/migrate.py", line 35, in <module>
from IPython.paths import get_ipython_dir
File "/Library/Python/2.7/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/Library/Python/2.7/site-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/Library/Python/2.7/site-packages/IPython/terminal/interactiveshell.py", line 93, in <module>
class TerminalInteractiveShell(InteractiveShell):
File "/Library/Python/2.7/site-packages/IPython/terminal/interactiveshell.py", line 138, in TerminalInteractiveShell
highlighting: \n %s""" % ', '.join(get_all_styles())
File "/Library/Python/2.7/site-packages/pygments/styles/__init__.py", line 79, in get_all_styles
for name, _ in find_plugin_styles():
File "/Library/Python/2.7/site-packages/pygments/plugin.py", line 62, in find_plugin_styles
for entrypoint in iter_entry_points(STYLE_ENTRY_POINT):
File "/Library/Python/2.7/site-packages/pygments/plugin.py", line 45, in iter_entry_points
import pkg_resources
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
Anyone know how to fix it?
I have searched it on google, but nothing is helpful on this particular issue.
I was facing the same problem but only in one of the two virtualenv on my machine. I had latest pip and same version of jupyter in both environments running on Python-2.7.9
Upon searching more, I found a similar issue which suggested using a specific version of setuptools
pip install setuptools==33.1.1
My setuptools version was setuptools-34.2.0 earlier.
At first I use python 2.7.10 , which will call the mistake. After change the version of python to 2.7.13 and reinstall jupyter, the problem is fixed:)
May be is easy, but really helpful!

Gevent - ImportError: No module named mako_templating

I’m following a video from 2012 - Gevent-socketio, cross-framework real-time web live demo (https://www.youtube.com/watch?v=zhh_N5pmHBY)
I’m working on Ubuntu 15.04.
At 8 mins, in init.py he corrects config.add_renderer('.html', 'pyramid.mako_templating.renderer_factory') but after that I still can’t get it to work. The error I’m getting is below.
Any and all help would be greatly appreciated.
Thank you
(env)cloud#cloudnetwork:~/Code/python/3/moo/Moo$ pserve --reload development.ini
Starting subprocess with file monitor
Traceback (most recent call last):
File "/home/cloud/Code/python/3/moo/env/bin/pserve", line 9, in <module>
load_entry_point('pyramid==1.5.7', 'console_scripts', 'pserve')()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 58, in main
return command.run()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 328, in run
global_conf=vars)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 363, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
val = callable(*args, **kw)
File "/home/cloud/Code/python/3/moo/Moo/moo/__init__.py", line 10, in main
config.add_renderer('.html', 'pyramid.mako_templating.renderer_factory')
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/util.py", line 528, in wrapper
result = wrapped(self, *arg, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/config/rendering.py", line 33, in add_renderer
factory = self.maybe_dotted(factory)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 825, in maybe_dotted
return self.name_resolver.maybe_resolve(dotted)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 320, in maybe_resolve
return self._resolve(dotted, package)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 327, in _resolve
return self._zope_dottedname_style(dotted, package)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 382, in _zope_dottedname_style
__import__(used)
ImportError: No module named mako_templating
The easiest way to register a new extension to be processed as a Mako template in Pyramid is as follows:
config.include('pyramid_mako')
config.add_mako_renderer('.html')
This will set up the renderer correctly.
Mako templating was removed from the Pyramid core framework, and thus pyramid.mako_templating.* no longer exists.
Depending on how you installed pyramid, you also need to install pyramid_mako, for instance by running pip install pyramid_mako. It's a separate module and is not a part of pyramid itself.

Pip install error

Whenever I try to use pip I receive the following error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources.py", line 720, in <module>
class Environment(object):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources.py", line 723, in Environment
def __init__(self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources.py", line 109, in get_supported_platform
plat = 'macosx-%s-%s' % ('.'.join(_macosx_vers()[:2]), m.group(3))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources.py", line 221, in _macosx_vers
version = platform.mac_ver()[0]
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.py", line 804, in mac_ver
info = _mac_ver_xml()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.py", line 781, in _mac_ver_xml
pl = plistlib.readPlist(fn)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 78, in readPlist
rootObject = p.parse(pathOrFile)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 406, in parse
parser.ParseFile(fileobj)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 418, in handleEndElement
handler()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 452, in end_key
self.currentKey = self.getData()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 436, in getData
data = data.encode("ascii")
LookupError: no codec search functions registered: can't find encoding
trying to run sudo easy_install pip results in the same message. I have previously used pip and received this when trying to install a virtualenv for a project. I can't think of any recent updates or system changes that would have caused this. Has anyone encountered this error message before?

Categories