curved-manchester-66006
12/21/2022, 4:21 AMpip_version2.16.0.dev3./pants run scripts/hello.py 
Traceback (most recent call last):
...
ImportError: No module named scripts.hellocurved-manchester-66006
12/21/2022, 4:23 AM$ ./pants roots
.
$ cat scripts/hello.py 
import modules.critical
print('hello')
$ cat modules/hello.py 
import modules.critical
print('hello')
$ ./pants run modules/hello.py 
hello
$ ./pants run modules/critical.py
$ ./pants run scripts/hello.py 
Traceback (most recent call last):
  File "/tmp/pants-sandbox-uOaYuI/./.cache/pex_root/venvs/27fadc29d37cd72af28911c9a5a9bb68222b5d90/4f398b5364288224a985fd546e447fdd048b6796/pex", line 248, in <module>
    runpy.run_module(module_name, run_name="__main__", alter_sys=True)
  File "/usr/local/lib/python3.7/runpy.py", line 201, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/usr/local/lib/python3.7/runpy.py", line 136, in _get_module_details
    raise error("No module named %s" % mod_name)
ImportError: No module named scripts.hellomodules.critical$ cat modules/bar.py 
bar='bar'
$ cat scripts/hello2.py 
import modules.bar
print('hello')
$ ./pants run scripts/hello2.py 
hellocurved-television-6568
12/21/2022, 3:15 PMcurved-television-6568
12/21/2022, 3:18 PMimport modules.criticalscripts/hello.py__init__.py./pants dependencies --transitive scripts/hello.py--keep-sandboxes=always__run.shcurved-manchester-66006
12/21/2022, 3:54 PMf you comment out theYes.inimport modules.criticaldoes it work then?scripts/hello.py
$ cat scripts/hello.py 
#import modules.critical
print('hello')
$ ./pants run scripts/hello.py 
hellodo you miss anyfiles?__init__.py
$ ls modules/__init__.py 
modules/__init__.py
$ ls scripts/__init__.py 
scripts/__init__.py__init__.py$ touch __init__.pydoes theIt's not obviously wrong to me, but it is also > 100 lines long. Like I said I haven't been able to get this to a minimal reproduction.look sane?./pants dependencies --transitive scripts/hello.py
if you run withI'd totally believe this is something silly withand inspect/run the--keep-sandboxes=alwaysfrom there (also check what files you have in the sandbox may be instructive)__run.sh
__init__..py/tmp/pants-sandbox-jxnlqA $ ./scripts.pex_pex_shim.sh
Traceback (most recent call last):
  File "/tmp/pants-sandbox-jxnlqA/.cache/pex_root/venvs/27fadc29d37cd72af28911c9a5a9bb68222b5d90/4f398b5364288224a985fd546e447fdd048b6796/pex", line 248, in <module>
    runpy.run_module(module_name, run_name="__main__", alter_sys=True)
  File "/usr/local/lib/python3.7/runpy.py", line 201, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/usr/local/lib/python3.7/runpy.py", line 136, in _get_module_details
    raise error("No module named %s" % mod_name)
ImportError: No module named scripts.hello/tmp/pants-sandbox-jxnlqA $ ./scripts.pex_bin_python_shim.sh
Python 3.7.15 (default, Dec 19 2022, 16:05:03) 
[GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scripts.hello
/tmp/pants-sandbox-jxnlqA/.cache/pex_root/venvs/27fadc29d37cd72af28911c9a5a9bb68222b5d90/4f398b5364288224a985fd546e447fdd048b6796/lib/python3.7/site-packages/airflow/configuration.py:276: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(sqlite3.sqlite_version) < StrictVersion(min_sqlite_version):
hello
>>>curved-television-6568
12/21/2022, 4:39 PMcurved-manchester-66006
12/21/2022, 9:34 PMsys.path['/home/ecsb/.cache/pants/named_caches/pex_root/venvs/27fadc29d37cd72af28911c9a5a9bb68222b5d90/4f398b5364288224a985fd546e447fdd048b6796', '/usr/local/lib/python37.zip', '/usr/local/lib/python3.7', '/usr/local/lib/python3.7/lib-dynload', '/home/ecsb/.cache/pants/named_caches/pex_root/venvs/s/19a57b50/venv/lib/python3.7/site-packages']ls -1 /home/ecsb/.cache/pants/named_caches/pex_root/venvs/27fadc29d37cd72af28911c9a5a9bb68222b5d90/4f398b5364288224a985fd546e447fdd048b6796/lib/python3.7/site-packages/ | wc -lls  /home/ecsb/.cache/pants/named_caches/pex_root/venvs/27fadc29d37cd72af28911c9a5a9bb68222b5d90/4f398b5364288224a985fd546e447fdd048b6796/lib/python3.7/site-packages/scripts/
build_api_docs.py            check_for_technical_terms.py  __init__.py         validate_docs_snippet_line_numbers.py
build_glossary_page.py       check_type_hint_coverage.py   __pycache__
check_docstring_coverage.py  docs_link_checker.py          trace_docs_deps.pyscripts$ cp -ra scripts crazy_scripts
$ ./pants   run crazy_scripts/hello.py 
16:32:25.50 [INFO] Initializing scheduler...
16:32:26.10 [INFO] Scheduler initialized.
hellocurved-television-6568
12/21/2022, 10:11 PM