I am new to Kivy and I am trying to do my first app with using Kivy. But in my first attemp I failed and unfortunately I couldn't find any answer from anywhere.
my code is:
import kivy
from kivy.app import App
from kivy.uix.label import Label
class EpicApp(App):
def build(self):
return Label(text="hi there")
if __name__ == "__main__":
EpicApp().run()
My error is simply:
UnicodeEncodeError: 'charmap' codec can't encode character '\u0131' in position 280: character maps to < undefined>
my whole error code is:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/burak/Desktop/Stuff/python for fun/kivy basics/kivyapp.py", line 13, in <module>
EpicApp().run()
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\app.py", line 829, in run
root = self.build()
File "C:/Users/burak/Desktop/Stuff/python for fun/kivy basics/kivyapp.py", line 9, in build
return Label(text="hi there")
File "kivy\_event.pyx", line 188, in kivy._event.EventDispatcher.__cinit__
File "kivy\properties.pyx", line 447, in kivy.properties.Property.link
File "kivy\properties.pyx", line 632, in kivy.properties.NumericProperty.init_storage
File "kivy\properties.pyx", line 418, in kivy.properties.Property.init_storage
File "kivy\properties.pyx", line 655, in kivy.properties.NumericProperty.convert
File "kivy\properties.pyx", line 663, in kivy.properties.NumericProperty.parse_str
File "kivy\properties.pyx", line 670, in kivy.properties.NumericProperty.parse_list
File "kivy\properties.pyx", line 296, in kivy.properties.dpi2px
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\utils.py", line 505, in __get__
retval = self.func(inst)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\metrics.py", line 174, in dpi
EventLoop.ensure_window()
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\base.py", line 123, in ensure_window
import kivy.core.window # NOQA
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\window\__init__.py", line 2068, in <module>
Window = core_select_lib('window', window_impl, True)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\__init__.py", line 103, in core_select_lib
'identify potential causes\n{1}'.format(category.capitalize(), err))
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 1425, in critical
self._log(CRITICAL, msg, args, **kwargs)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 1514, in _log
self.handle(record)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 1524, in handle
self.callHandlers(record)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 1586, in callHandlers
hdlr.handle(record)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 894, in handle
self.emit(record)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\logger.py", line 247, in emit
self._write_message(message)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\logger.py", line 218, in _write_message
stream.write(fs % msg)
File "C:\Users\burak\AppData\Local\Programs\Python\Python37-32\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u0131' in position 280: character maps to <undefined>
edit: When I tried to open file from cmd I get this error.(Normally I am using PyCharm)
[ERROR ] [Clock ] Unable to import kivy._clock. Have you perhaps forgotten to compile kivy? Kivy contains Cython code which needs to be compiled. A missing kivy._clock often indicates the Cython code has not been compiled. Please follow the installation instructions and make sure to compile Kivy Traceback (most recent call last): File "kivyapp.py", line 2, in <module>
from kivy.app import App File "C:\Users\burak\AppData\Roaming\Python\Python37\site-packages\kivy\app.py", line 319, in <module>
from kivy.base import runTouchApp, stopTouchApp File "C:\Users\burak\AppData\Roaming\Python\Python37\site-packages\kivy\base.py", line 26, in <module>
from kivy.clock import Clock File "C:\Users\burak\AppData\Roaming\Python\Python37\site-packages\kivy\clock.py", line 363, in <module>
from kivy._clock import CyClockBase, ClockEvent, FreeClockEvent, \ ModuleNotFoundError: No module named 'kivy._clock'
Related
Few days ago, Anaconda Navigator used to work fine but now it won't open; I've even reinstalled the navigator but still getting the same issue.
Here is the error message
Navigator Error:
An unexpected error occurred on Navigator start-up
Main Error
unacceptable character #x0000: special characters are not allowed
in "C:\Users\home\.continuum\anaconda-client\config.yaml", position 0
Traceback
Traceback (most recent call last):
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\exceptions.py", line 72, in exception_handler
return_value = func(*args, **kwargs)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 146, in start_app
window = run_app(splash)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 65, in run_app
window = MainWindow(splash=splash)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 165, in __init__
self.api = AnacondaAPI()
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 1518, in AnacondaAPI
ANACONDA_API = _AnacondaAPI()
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 83, in __init__
self._client_api = ClientAPI(config=self.config)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\client_api.py", line 659, in ClientAPI
CLIENT_API = _ClientAPI(config=config)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\client_api.py", line 95, in __init__
self.reload_client()
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\client_api.py", line 322, in reload_client
url = binstar_client.utils.get_config()['url']
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 249, in get_config
file_configs = load_file_configs(SEARCH_PATH)
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 241, in load_file_configs
raw_data = collections.OrderedDict(kv for kv in itertools.chain.from_iterable(load_paths))
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 241, in
raw_data = collections.OrderedDict(kv for kv in itertools.chain.from_iterable(load_paths))
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 221, in _dir_yaml_loader
yield filepath, load_config(filepath)
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 205, in load_config
data = yaml_load(fd)
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\yaml.py", line 12, in yaml_load
return safe_load(stream)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\__init__.py", line 162, in safe_load
return load(stream, SafeLoader)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\__init__.py", line 112, in load
loader = Loader(stream)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\loader.py", line 34, in __init__
Reader.__init__(self, stream)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\reader.py", line 85, in __init__
self.determine_encoding()
File "C:\Users\home\anaconda3\lib\site-packages\yaml\reader.py", line 135, in determine_encoding
self.update(1)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\reader.py", line 169, in update
self.check_printable(data)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\reader.py", line 143, in check_printable
raise ReaderError(self.name, position, ord(character),
yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed
in "C:\Users\home\.continuum\anaconda-client\config.yaml", position 0
According to github the problem lies with "config.yaml" file in C:\Users\axith.continuum\anaconda-client\config.yaml , rename it to config.old or delete it
I run the python code from the root. Shows an error when I just imported the module:
ERROR : Traceback (most recent call last):
File "/home/amir/photo.py", line 4, in <module>
import pyautogui as gui
File "/usr/local/lib/python3.9/dist-packages/pyautogui/__init__.py", line 249, in <module>
import mouseinfo
File "/usr/local/lib/python3.9/dist-packages/mouseinfo/__init__.py", line 223, in <module>
_display = Display(os.environ['DISPLAY'])
File "/usr/local/lib/python3.9/dist-packages/Xlib/display.py", line 80, in __init__
self.display = _BaseDisplay(display)
File "/usr/local/lib/python3.9/dist-packages/Xlib/display.py", line 62, in __init__
display.Display.__init__(*(self, ) + args, **keys)
File "/usr/local/lib/python3.9/dist-packages/Xlib/protocol/display.py", line 129, in __init__
raise error.DisplayConnectionError(self.display_name, r.reason)
Xlib.error.DisplayConnectionError: Can't connect to display ":1": b'No protocol specified\n'
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!
Colleague provided me set of py files for testing, which are running fine on his machine. However when I run the py files, I am getting following error:
Traceback (most recent call last):
File "D:\workspaces\pyworkspace\Analytics Python\python_server\server1.py", line 84, in <module>
start_server()
File "D:\workspaces\pyworkspace\Analytics Python\python_server\server1.py", line 57, in start_server
socketObj.bind(server_address)
LookupError: unknown encoding: idna
Here, it says to add import encodings.idna. So I added that import (even though eclipse says "unused import"), but still getting the same error. So I put some breakpoints and started up debugging, but debugger didnt hit the breakpoints. The program termniates without hitting any breakpoints giving following error:
pydev debugger: starting (pid: 8316)
Traceback (most recent call last):
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15515)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_34_64.c:5631)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 764, in do_wait_suspend
self._activate_mpl_if_needed()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 416, in _activate_mpl_if_needed
activate_function()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 407, in <lambda>
self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 93, in activate_matplotlib
is_interactive = is_interactive_backend(backend)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 56, in is_interactive_backend
from matplotlib.rcsetup import interactive_bk, non_interactive_bk # #UnresolvedImport
ImportError: cannot import name 'interactive_bk'
Traceback (most recent call last):
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1621, in <module>
main()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1615, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1022, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:\Mahesh\workspaces\pyworkspace\Analytics Python\python_server\server.py", line 84, in <module>
start_server()
File "D:\Mahesh\workspaces\pyworkspace\Analytics Python\python_server\server.py", line 84, in <module>
start_server()
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 982, in _pydevd_bundle.pydevd_cython_win32_34_64.SafeCallWrapper.__call__ (_pydevd_bundle/pydevd_cython_win32_34_64.c:19346)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 498, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:18639)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 750, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15669)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15515)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_34_64.c:5631)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 764, in do_wait_suspend
self._activate_mpl_if_needed()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 416, in _activate_mpl_if_needed
activate_function()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 407, in <lambda>
self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 93, in activate_matplotlib
is_interactive = is_interactive_backend(backend)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 56, in is_interactive_backend
from matplotlib.rcsetup import interactive_bk, non_interactive_bk # #UnresolvedImport
ImportError: cannot import name 'interactive_bk'
Why is this happening? (I am using python 3.4, eclipse oxygen 4.7 and PyDev 6.2.0.201711281614)
Apparently the problem is because pydev is expecting matplotlib to have some modules which aren't available in your installation... so, the import:
from matplotlib.rcsetup import interactive_bk, non_interactive_bk # #UnresolvedImport
is failing (and that's expected in PyDev if you have matplotlib installed).
Not sure why... I need to investigate whether you have a broken matplotlib or if matplotlib actually changed (in which case the pydev debugger would need to be fixed).
Can you add details on the matplotlib version you have?
When I want to import clr, then My kivy env got crashed.
Traceback (most recent call last):
File "demo.py", line 86, in <module>
demoApp().run()
File "C:\Python27\lib\site-packages\kivy\app.py", line 801, in run
self.load_kv(filename=self.kv_file)
File "C:\Python27\lib\site-packages\kivy\app.py", line 598, in load_kv
root = Builder.load_file(rfilename)
File "C:\Python27\lib\site-packages\kivy\lang\builder.py", line 301, in load_file
return self.load_string(data, **kwargs)
File "C:\Python27\lib\site-packages\kivy\lang\builder.py", line 379, in load_string
widget = Factory.get(parser.root.name)()
File "C:\Python27\lib\site-packages\kivy\factory.py", line 139, in __getattr__
module = __import__(name=item['module'], fromlist='.')
TypeError: __import__() takes at least 1 argument (0 given)
Could anyone help me with this? Thanks.