Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: PYTHONPATH translation to sys.path fails if not single folder. #2527

Open
5 tasks done
reformstudios opened this issue Jan 17, 2025 · 0 comments
Open
5 tasks done
Labels
Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class]

Comments

@reformstudios
Copy link

✈ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a similar issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

// manually add PYTHONPATH since we are overwriting the sys paths
var pythonPath = Environment.GetEnvironmentVariable("PYTHONPATH");
if (!string.IsNullOrEmpty(pythonPath))
{
sysPaths.Append(new PyString(pythonPath));
}

PYTHONPATH is treated as a single path, rather than a list of paths.
It should be converted to sys,path as a list of paths, not a single path.
This prevents users from being able to define multiple external dependencies for pyrevit applications at runtime (eg when revit launches).

⌨ Error/Debug Message

n/a

♻️ To Reproduce

  1. From shell, set pythonpath to multiple folders ; eg $env:PYTHONPATH="/path/a;/path/b"
  2. launch revit
  3. Launch script that attempts to import module in either path.
  4. Observe import failing.

⏲️ Expected behavior

Pyrevit should initialise with existing PYTHONPATH being translated correctly to sys.path entries where PYTHONPATH is a list of folders not just a single folder.

🖥️ Hardware and Software Setup (please complete the following information)

n/a

Additional context

This is in the context of a VFX studio where python environment are defined prior to launching DCCs using PYTHONPATH with all dependencies added (typically using the "Rez" package manager).

@reformstudios reformstudios added the Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class] label Jan 17, 2025
@reformstudios reformstudios changed the title [Bug]: [Bug]: PYTHONPATH translation to sys.path fails if not single folder. Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class]
Projects
None yet
Development

No branches or pull requests

1 participant