如何修复“在库'<None>'中找不到错误:符号'setMsgSeverity':python:未定义符号:setMsgSeverity“天蓝色函数python”

时间:2019-10-13 08:23:11

标签: python azure-functions ocr leptonica

我在以azure函数运行的python脚本上导入ocrmypdf lib时遇到问题。

Function应用程序正在WestEurope地区的linux和B1 appserviceplan上运行。

import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), 'a/Lib/site-packages')))
import logging
from invoice2data import extract_data
import json
import img2pdf
from ocrmypdf import leptonica
import ocrmypdf
import azure.functions as func
from azure.cosmosdb.table.tableservice import TableService
from azure.cosmosdb.table.models import Entity

我希望导入lib时不会出现错误,但实际上最终会出现以下错误:

Result: Failure
Exception: error: symbol 'setMsgSeverity' not found in library '<None>': python: undefined symbol: setMsgSeverity
Stack:   File "/usr/local/lib/python3.6/site-packages/azure_functions_worker/dispatcher.py", line 240, in _handle__function_load_request
    func_request.metadata.entry_point)
  File "/usr/local/lib/python3.6/site-packages/azure_functions_worker/loader.py", line 66, in load_function
    mod = importlib.import_module(fullmodname)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/site/wwwroot/BlobTrigger/__init__.py", line 9, in <module>
    from ocrmypdf import leptonica
  File "/home/site/wwwroot/.python_packages/lib/python3.6/site-packages/ocrmypdf/__init__.py", line 18, in <module>
    from . import helpers, hocrtransform, leptonica, pdfa, pdfinfo
  File "/home/site/wwwroot/.python_packages/lib/python3.6/site-packages/ocrmypdf/leptonica.py", line 43, in <module>
    lept.setMsgSeverity(lept.L_SEVERITY_WARNING)

任何建议都会被采纳:)

0 个答案:

没有答案