rules_python
                                
                                
                                
                                    rules_python copied to clipboard
                            
                            
                            
                        bazel-runfiles module always throws ValueError
🐞 bug report
Affected Rule
bazel-runfiles ackage
Is this a regression?
Appears to be, we were using bazel-runfiles on v0.12.0 with no issue
Description
When running a py_binary target, the main file is executed from within the runfiles tree, but everything imported points back to the original workspace. As a result of this, if you try to use bazel-runfiles, you're always met with this ValueError:
ValueError: /home/andrew/workspace/rules_python_runfiles_repro/my_module/__init__.py does not lie under the runfiles root /home/andrew/.cache/bazel/_bazel_andrew/43e798d9071ddd30271aac70168abdc4/execroot/_main/bazel-out/k8-fastbuild/bin/hello_world.runfiles
🔬 Minimal Reproduction
https://github.com/AndrewGuenther/rules_python_1631_repro
Minimal reproduction repository linked above.
🔥 Exception or Error
ValueError: /home/andrew/workspace/rules_python_runfiles_repro/my_module/__init__.py does not lie under the runfiles root /home/andrew/.cache/bazel/_bazel_andrew/43e798d9071ddd30271aac70168abdc4/execroot/_main/bazel-out/k8-fastbuild/bin/hello_world.runfiles
🌍 Your Environment
Operating System:
  
Ubuntu
  
Output of bazel version:
  
6.4.0
  
Rules_python version:
  
0.27.1
  
Anything else relevant?