我在为 xgboost 库创建 lambda 层时遇到问题。我在跑:
我从这里 ( https://github.com/alexeybutyrev/aws_lambda_xgboost )抓取 xgboost 的 zip 和它的依赖项并将其加载到一个层中。当我尝试测试我的 lambda 时,我收到此错误:
Unable to import module 'lambda_function': No module named 'xgboost.core'
看起来__init__.py
正在尝试通过引用 core.pyfrom .core import <stuff>
有没有人在使用 AWS Lambda 之前遇到过这个错误?
python package-management amazon-web-services aws-lambda xgboost
我正在尝试将日志记录添加到一些 Jupyter Notebook 代码(运行 Pyspark3)。
仔细研究,我发现了一些答案,说使用basicConfig()
不起作用,因为笔记本启动了自己的日志记录会话。一些解决方法的答案指向运行reload(logging)
来解决这个问题。考虑到这一点,我正在像这样设置我的日志记录:
from importlib import reload # Not needed in Python 2
import logging
reload(logging)
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
level=logging.INFO,
datefmt="%y/%m/%d %H:%M:%S",
)
logger = logging.getLogger(__name__)
Run Code Online (Sandbox Code Playgroud)
然后我运行一个 info 语句:logger.info("this is a test")
我收到一个 I/O 值错误?我不确定这意味着什么。
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib64/python3.6/logging/__init__.py", line 994, in emit
stream.write(msg)
File "/tmp/2950371398694308674", line 534, in write
super(UnicodeDecodingStringIO, self).write(s)
ValueError: I/O operation on closed file
Call stack: …
Run Code Online (Sandbox Code Playgroud)