我试图导入数据库上的camelot包,我第一次面临附加的错误。同样的剧本一直运行到2023年8月9日。但是现在我得到了这个TypeError。我试着寻找解决方案,但找不到任何我可以使用的东西。如果有人在卡米洛特工作时看到过这个,请帮助。
错误提示:
TypeError Traceback (most recent call last)
File <command-1234471206721195>:5
3 import re
4 import time
----> 5 import camelot
6 import requests
7 import smtplib
File /databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py:171, in _create_import_patch.<locals>.import_patch(name, globals, locals, fromlist, level)
166 thread_local._nest_level += 1
168 try:
169 # Import the desired module. If you’re seeing this while debugging a failed import,
170 # look at preceding stack frames for relevant error information.
--> 171 original_result = python_builtin_import(name, globals, locals, fromlist, level)
173 is_root_import = thread_local._nest_level == 1
174 # `level` represents the number of leading dots in a relative import statement.
175 # If it's zero, then this is an absolute import.
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/camelot/__init__.py:6
3 import logging
5 from .__version__ import __version__
----> 6 from .io import read_pdf
7 from .plotting import PlotMethods
10 # set up logging
File /databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py:171, in _create_import_patch.<locals>.import_patch(name, globals, locals, fromlist, level)
166 thread_local._nest_level += 1
168 try:
169 # Import the desired module. If you’re seeing this while debugging a failed import,
170 # look at preceding stack frames for relevant error information.
--> 171 original_result = python_builtin_import(name, globals, locals, fromlist, level)
173 is_root_import = thread_local._nest_level == 1
174 # `level` represents the number of leading dots in a relative import statement.
175 # If it's zero, then this is an absolute import.
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/camelot/io.py:5
1 # -*- coding: utf-8 -*-
3 import warnings
----> 5 from .handlers import PDFHandler
6 from .utils import validate_input, remove_extra
9 def read_pdf(
10 filepath,
11 pages="1",
(...)
16 **kwargs
17 ):
File /databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py:171, in _create_import_patch.<locals>.import_patch(name, globals, locals, fromlist, level)
166 thread_local._nest_level += 1
168 try:
169 # Import the desired module. If you’re seeing this while debugging a failed import,
170 # look at preceding stack frames for relevant error information.
--> 171 original_result = python_builtin_import(name, globals, locals, fromlist, level)
173 is_root_import = thread_local._nest_level == 1
174 # `level` represents the number of leading dots in a relative import statement.
175 # If it's zero, then this is an absolute import.
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/camelot/handlers.py:9
6 from pypdf import PdfReader, PdfWriter
8 from .core import TableList
----> 9 from .parsers import Stream, Lattice
10 from .utils import (
11 TemporaryDirectory,
12 get_page_layout,
(...)
16 download_url,
17 )
20 class PDFHandler(object):
File /databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py:171, in _create_import_patch.<locals>.import_patch(name, globals, locals, fromlist, level)
166 thread_local._nest_level += 1
168 try:
169 # Import the desired module. If you’re seeing this while debugging a failed import,
170 # look at preceding stack frames for relevant error information.
--> 171 original_result = python_builtin_import(name, globals, locals, fromlist, level)
173 is_root_import = thread_local._nest_level == 1
174 # `level` represents the number of leading dots in a relative import statement.
175 # If it's zero, then this is an absolute import.
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/camelot/parsers/__init__.py:4
1 # -*- coding: utf-8 -*-
3 from .stream import Stream
----> 4 from .lattice import Lattice
File /databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py:171, in _create_import_patch.<locals>.import_patch(name, globals, locals, fromlist, level)
166 thread_local._nest_level += 1
168 try:
169 # Import the desired module. If you’re seeing this while debugging a failed import,
170 # look at preceding stack frames for relevant error information.
--> 171 original_result = python_builtin_import(name, globals, locals, fromlist, level)
173 is_root_import = thread_local._nest_level == 1
174 # `level` represents the number of leading dots in a relative import statement.
175 # If it's zero, then this is an absolute import.
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/camelot/parsers/lattice.py:25
14 from ..core import Table
15 from ..utils import (
16 scale_image,
17 scale_pdf,
(...)
23 compute_whitespace,
24 )
---> 25 from ..image_processing import (
26 adaptive_threshold,
27 find_lines,
28 find_contours,
29 find_joints,
30 )
31 from ..backends.image_conversion import BACKENDS
34 logger = logging.getLogger("camelot")
File /databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py:171, in _create_import_patch.<locals>.import_patch(name, globals, locals, fromlist, level)
166 thread_local._nest_level += 1
168 try:
169 # Import the desired module. If you’re seeing this while debugging a failed import,
170 # look at preceding stack frames for relevant error information.
--> 171 original_result = python_builtin_import(name, globals, locals, fromlist, level)
173 is_root_import = thread_local._nest_level == 1
174 # `level` represents the number of leading dots in a relative import statement.
175 # If it's zero, then this is an absolute import.
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/camelot/image_processing.py:3
1 # -*- coding: utf-8 -*-
----> 3 import cv2
4 import numpy as np
7 def adaptive_threshold(imagename, process_background=False, blocksize=15, c=-2):
File /databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py:171, in _create_import_patch.<locals>.import_patch(name, globals, locals, fromlist, level)
166 thread_local._nest_level += 1
168 try:
169 # Import the desired module. If you’re seeing this while debugging a failed import,
170 # look at preceding stack frames for relevant error information.
--> 171 original_result = python_builtin_import(name, globals, locals, fromlist, level)
173 is_root_import = thread_local._nest_level == 1
174 # `level` represents the number of leading dots in a relative import statement.
175 # If it's zero, then this is an absolute import.
File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:664, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:627, in _load_backward_compatible(spec)
File /databricks/python_shell/dbruntime/PostImportHook.py:218, in _ImportHookChainedLoader.load_module(self, fullname)
216 def load_module(self, fullname):
217 try:
--> 218 module = self.loader.load_module(fullname)
219 notify_module_loaded(module)
220 except (ImportError, AttributeError):
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/cv2/__init__.py:181
176 if DEBUG: print("Extra Python code for", submodule, "is loaded")
178 if DEBUG: print('OpenCV loader: DONE')
--> 181 bootstrap()
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/cv2/__init__.py:175, in bootstrap()
172 if DEBUG: print('OpenCV loader: binary extension... OK')
174 for submodule in __collect_extra_submodules(DEBUG):
--> 175 if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
176 if DEBUG: print("Extra Python code for", submodule, "is loaded")
178 if DEBUG: print('OpenCV loader: DONE')
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/cv2/__init__.py:28, in __load_extra_py_code_for_module(base, name, enable_debug_print)
26 native_module = sys.modules.pop(module_name, None)
27 try:
---> 28 py_module = importlib.import_module(module_name)
29 except ImportError as err:
30 if enable_debug_print:
File /usr/lib/python3.9/importlib/__init__.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7f856e60-6cd1-4854-8503-cef3ccc841c4/lib/python3.9/site-packages/cv2/typing/__init__.py:69
65 import typing
68 if numpy.lib.NumpyVersion(numpy.__version__) > "1.20.0" and sys.version_info >= (3, 9):
---> 69 NumPyArrayGeneric = numpy.ndarray[typing.Any, numpy.dtype[numpy.generic]]
70 else:
71 NumPyArrayGeneric = numpy.ndarray
TypeError: 'numpy._DTypeMeta' object is not subscriptable
我试图导入Python包,我希望'导入Camelot'能够正确导入
1条答案
按热度按时间t5fffqht1#
甚至,我也犯了和你一样的错误。
这是因为
NumPy
版本不兼容。将NumPy升级到最新版本或安装到最新版本以下。并成功导入。