Skip to content Skip to sidebar Skip to footer

Getting Error : No Module Named 'calendar_ui'. Even Though Kivycalendar Has Been Installed Using Pip In Windows 10

KivyCalendar has been installed using pip in windows 10. But returns an error:- No module named 'calendar_ui My code is: from kivy.app import App from KivyCalendar import Calenda

Solution 1:

I had a few troubles using KivyCalendar in my project so I made a few improvements to make it work on Python 3. Make sure to have a copy of original files.

Add lines which are having a + mark at the beginning of the line and remove files which are having a - mark at the beginning of the line.

First of all find the directory where kivycalendar is installed.

KivyCalendar/init.py

#!/usr/bin/python# -*- coding: utf-8 -*-

 -from calendar_ui import DatePicker, CalendarWidget
 +from .calendar_ui import DatePicker, CalendarWidget

KivyCalendar/calendar_data.py

-from calendar import TimeEncoding, month_name, day_abbr, Calendar, monthrange
+from calendar import month_name, day_abbr, Calendar, monthrange
 from datetime import datetime
 from locale import getdefaultlocale
+import locale as _locale
+
+
+classTimeEncoding:
+    def__init__(self, locale):
+        self.locale = locale
+
+    def__enter__(self):
+        self.oldlocale = _locale.setlocale(_locale.LC_TIME, self.locale)
+        return _locale.getlocale(_locale.LC_TIME)[1]
+
+    def__exit__(self, *args):
+        _locale.setlocale(_locale.LC_TIME, self.oldlocale)
+

 defget_month_names():
     """ Return list with months names """

KivyCalendar/calendar_ui.py

from kivy.core.window import Window
 from kivy.properties import NumericProperty, ReferenceListProperty

-import calendar_data as cal_data
+from . import calendar_data as cal_data
 ###########################################################
 Builder.load_string("""
 <ArrowButton>:

Solution 2:

This error happens only on Python 3, on Python 2.7 everything works fine.

As you can see in module's description it's compatible with Python 2.7 only:

Programming Language :: Python :: 2.7

You have not much choice here: either use Python 2.7 or fork project and create calendar that works with Python 3.

Post a Comment for "Getting Error : No Module Named 'calendar_ui'. Even Though Kivycalendar Has Been Installed Using Pip In Windows 10"