小编Hay*_*den的帖子

仅使用AWS Lambda加载本地模块时出现问题

应用程序结构:

.
??? Makefile
??? Pipfile
??? Pipfile.lock
??? README.md
??? template.yaml
??? tests
?   ??? __init__.py
?   ??? unit
?       ??? lambda_application
?           ??? test_handler.py
?           ??? test_parent_child_class.py
??? lambda_application
    ??? __init__.py
    ??? first_child_class.py
    ??? lambda_function.py
    ??? second_child_class.py
    ??? requirements.txt
    ??? parent_class.py

4 directories, 14 files
Run Code Online (Sandbox Code Playgroud)

来自的代码示例lambda_function.py

import os
import json
from hashlib import sha256
import boto3
from requests import Session
from .first_child_class import FirstChildClass


def lambda_handler(event, context):
    # Do some stuff.
Run Code Online (Sandbox Code Playgroud)

照原样,我收到错误消息“无法导入模块'lambda_function'”,但是如果我注释掉了最后一个导入,“从.first_child_class import FirstChildClass”,它可以越过该部分并得到我没有的错误。为该类加载了模块。

当我在lambci / …

python amazon-web-services python-3.x aws-lambda

4
推荐指数
1
解决办法
1228
查看次数

如果不传递 --ansi 则无法在 PHP CLI 中获取 ANSI 颜色

我正在使用 CentOS 7 和 PHP 7.0

TERM=xterm-256color

我确实有一个彩色提示和 ls 颜色,如果我通过了,--ansi它确实会显示彩色,但我不想总是添加--ansi

我正在使用的两个特定项目composer来自app/consoleSymfony 2.8

php ansi-escape symfony composer-php

2
推荐指数
1
解决办法
621
查看次数