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 PMwitty-crayon-22786
03/14/2019, 7:46 PMwitty-crayon-22786
03/14/2019, 7:46 PM-src
- main
- python
- company
- package1
- BUILD
- app.py
- module.pywitty-crayon-22786
03/14/2019, 7:46 PMBUILD contained...ancient-petabyte-32039
03/14/2019, 7:46 PMancient-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 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.pywitty-crayon-22786
03/14/2019, 7:48 PMsrc/main/python/**, which will cause the package names to be relative to that pathwitty-crayon-22786
03/14/2019, 7:48 PMwitty-crayon-22786
03/14/2019, 7:48 PMsrc/main/pythonwitty-crayon-22786
03/14/2019, 7:49 PMfrom company.cloudwatch_to_tsd import moduleancient-petabyte-32039
03/14/2019, 7:49 PMimportlib.import_module(company.cloudwatch_to_tsd .module)?ancient-petabyte-32039
03/14/2019, 7:50 PMancient-petabyte-32039
03/14/2019, 7:54 PMcw_module = importlib.import_module('module') works with out pexancient-petabyte-32039
03/14/2019, 7:54 PMPYTHONPATHwitty-crayon-22786
03/14/2019, 8:02 PMwitty-crayon-22786
03/14/2019, 8:02 PMwitty-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') failsancient-petabyte-32039
03/14/2019, 8:08 PM__init__.py under cloudwatch_to_tsd directorywitty-crayon-22786
03/14/2019, 8:08 PMwitty-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 mergedwitty-crayon-22786
03/14/2019, 8:09 PMancient-petabyte-32039
03/14/2019, 8:09 PM