We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8dbecad commit 5ab5739Copy full SHA for 5ab5739
pdoc/cli.py
@@ -396,6 +396,15 @@ def main(_args=None):
396
# Support loading modules specified as python paths relative to cwd
397
sys.path.append(os.getcwd())
398
399
+ # Virtual environment handling for pdoc script run from system site
400
+ try:
401
+ venv_dir = os.environ['VIRTUAL_ENV']
402
+ except KeyError:
403
+ pass # pdoc was not invoked while in a virtual environment
404
+ else:
405
+ from distutils.sysconfig import get_python_lib
406
+ sys.path.append(get_python_lib(prefix=venv_dir))
407
+
408
if args.http:
409
template_config['link_prefix'] = "/"
410
0 commit comments