Skip to content

Commit 617fff8

Browse files
committed
Check fails in loading modules.
1 parent e38eb25 commit 617fff8

47 files changed

Lines changed: 75 additions & 10 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

mathics/builtin/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import re
88
import os.path as osp
99
from mathics.settings import ENABLE_FILES_MODULE
10+
from mathics.version import __version__
1011

1112
# Get a list of file in this directory. We'll exclude from the start
1213
# files with leading characters we don't want like __init__ with its leading underscore.
@@ -38,9 +39,15 @@
3839
for module_name in module_names:
3940
try:
4041
module = importlib.import_module("mathics.builtin." + module_name)
41-
except:
42-
# print("XXX", module_name)
42+
except Exception as e:
43+
print(e)
44+
print(f" Not able to load {module_name}. Check your installation.")
45+
print(f" mathics.builtin loads from {__file__[:-11]}")
4346
continue
47+
48+
if __version__ != module.__version__:
49+
print(f"Version {module.__version__} in the module do not match with {__version__}")
50+
4451
modules.append(module)
4552

4653
builtins = []

mathics/builtin/algebra.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Algebraic Manipulation
55
"""
66

7+
from mathics.version import __version__
78

89
from mathics.builtin.base import Builtin
910
from mathics.core.expression import Expression, Integer, Symbol, Atom, Number

mathics/builtin/arithmetic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Basic arithmetic functions, including complex number arithmetic.
99
"""
1010

11-
11+
from mathics.version import __version__
1212
import sympy
1313
import mpmath
1414

mathics/builtin/assignment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
4+
from mathics.version import __version__
55
import mathics.builtin
66
from mathics.builtin.base import (
77
Builtin, BinaryOperator, PostfixOperator, PrefixOperator)

mathics/builtin/attributes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
However, you can set any symbol as an attribute, in contrast to \Mathematica.
99
"""
1010

11+
from mathics.version import __version__
1112

1213
from mathics.builtin.base import Predefined, Builtin
1314
from mathics.builtin.evaluation import Sequence

mathics/builtin/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import typing
1111
from typing import Any, cast
1212

13+
from mathics.version import __version__
14+
1315
from mathics.core.definitions import Definition
1416
from mathics.core.parser.util import SystemDefinitions, PyMathicsDefinitions
1517
from mathics.core.rules import Rule, BuiltinRule, Pattern

mathics/builtin/calculus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55
Calculus
66
"""
7+
from mathics.version import __version__
78

89
from mathics.builtin.base import Builtin, PostfixOperator, SympyFunction
910
from mathics.core.expression import (Expression, Integer, Number, SymbolTrue, SymbolFalse)

mathics/builtin/colors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from itertools import chain
55
from math import pi
66

7+
from mathics.version import __version__
8+
79
from mathics.builtin.numpy_utils import sqrt, floor, mod, cos, sin, arctan2, minimum, maximum, dot_t
810
from mathics.builtin.numpy_utils import stack, unstack, array, clip, conditional, choose, stacked
911

mathics/builtin/combinatorial.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import sympy
99
from sympy.functions.combinatorial.numbers import stirling
10+
from mathics.version import __version__
1011

1112
from mathics.builtin.base import Builtin
1213
from mathics.core.expression import Expression, Integer, Symbol, SymbolTrue, SymbolFalse

mathics/builtin/comparison.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import Optional, Union
77

88
import sympy
9+
from mathics.version import __version__
910

1011
from mathics.builtin.base import (
1112
BinaryOperator,

0 commit comments

Comments
 (0)