ancient-petabyte-32039
03/14/2019, 7:41 PMmodule
from app.py and it's getting no module found errorwitty-crayon-22786
03/14/2019, 7:45 PM-src
- main
- python
- company
- package1
- BUILD
- app.py
- module.py
BUILD
contained...ancient-petabyte-32039
03/14/2019, 7:46 PMpython_binary(
name = 'cloudwatch_to_tsd',
entry_point = '<http://pinterest.cloudwatch_to_tsd.app:main|pinterest.cloudwatch_to_tsd.app:main>',
dependencies = [
':_cloudwatch_to_tsd'
]
)
python_library(
name = '_cloudwatch_to_tsd',
sources = rglobs('*.py'),
dependencies = [
'3rdparty/python:boto3',
'3rdparty/python:brood',
'3rdparty/python:pyknox',
'3rdparty/python:schedule',
'3rdparty/python:pinstatsd',
'3rdparty/python:metrics-agent'
]
)
witty-crayon-22786
03/14/2019, 7:47 PMancient-petabyte-32039
03/14/2019, 7:47 PMpackage1
in my examplewitty-crayon-22786
03/14/2019, 7:47 PMancient-petabyte-32039
03/14/2019, 7:48 PM-src
- main
- python
- company
- cloudwatch_to_tsd
- BUILD
- app.py
- module.py
witty-crayon-22786
03/14/2019, 7:48 PMsrc/main/python/**
, which will cause the package names to be relative to that pathsrc/main/python
from company.cloudwatch_to_tsd import module
ancient-petabyte-32039
03/14/2019, 7:49 PMimportlib.import_module(company.cloudwatch_to_tsd .module)
?cw_module = importlib.import_module('module')
works with out pexPYTHONPATH
witty-crayon-22786
03/14/2019, 8:02 PMunzip -l $pexfile
will show you the contentsancient-petabyte-32039
03/14/2019, 8:04 PMwitty-crayon-22786
03/14/2019, 8:06 PM__init__.py
files? pex will create someancient-petabyte-32039
03/14/2019, 8:06 PMimport module
modeul.something()
witty-crayon-22786
03/14/2019, 8:07 PMancient-petabyte-32039
03/14/2019, 8:07 PMimportlib.import_module('module')
fails__init__.py
under cloudwatch_to_tsd directorywitty-crayon-22786
03/14/2019, 8:08 PMancient-petabyte-32039
03/14/2019, 8:08 PMwitty-crayon-22786
03/14/2019, 8:08 PMpants.contrib
package across a bunch of directories, and then they are mergedancient-petabyte-32039
03/14/2019, 8:09 PM