08-31-2022 02:46 PM
Good afternoon everyone,
I am new to LabVIEW and one of the projects I am currently working on utilizes Python to perform pdf scraping and data analysis, and sends the data back to LabVIEW.
When building the executable to deploy, the python files are not being picked up in the executable and therefore the project is not performing the job it should be doing. I read online that what people were using Python Integration Toolkit, which looked like it would solve all of my problems but as I was trying to get it to work I have stumbled into the issue that it is past the End of Life, and could be the reason why I am not able to get PIT working.
So I was wondering what people are using now in place of that? With PIT you were able to select the python file you were using to make sure your executable build included it, the version of python so that each station that would use the executable would not need python installed manually onto it, and each python package you needed for the executable.
08-31-2022 04:25 PM - edited 08-31-2022 04:29 PM
In 2018 this was replaced with a set of Python functions native to LabVIEW:
https://www.ni.com/docs/en-US/bundle/labview/page/glang/python_pal.html
No toolkit needed if those would work for you.
If you need to pack them in the build that's a bit trickier. You can make any file you like a member of a class and if the class is included in the build, so is the file.
08-31-2022 04:29 PM
Yes the Native Python Functions work just fine for me, but I am having issues deploying the project. It does not seem to be including my python files in the build/executable.
08-31-2022 04:42 PM
I've used this code before when I include a file in a class, that then gets included in the build, that I need to find on disk later.
Is it OK if the Python code is included just "adjacent to" the EXE instead of built inside it?
08-31-2022 04:52 PM
I believe it should be okay if the python file is adjacent instead of in the .exe, this is the current layout of my project explorer and then one of the snippets of code where I reference/find the python file I need for that particular instance.
This currently works on my computer, but trying to deploy this to the test pc is where I am having issues.
08-31-2022 05:17 PM
The node you have in there to start your path building appears to be the "current VI's path" node, which does not work the way you think it might when built into an EXE. It usually returns something like "C:\Your_program.exe\Your_VI_name.vi" so if you strip the path just once, you are still pointing at your EXE and not at a directory. It isn't something you ought to rely on so I wouldn't recommend a quick patch job where you strip the path one extra time if it's an EXE or whatever.
I would recommend you remove the "Current VI's path" node completely and use an alternate way to find the path to the file you need to reference, one that would work for both a VI and a built EXE. Either code like mine, or some other form of searching starting from a path coming from somewhere like the Get System Directory VI, which is independent of where the calling code is located.
08-31-2022 05:26 PM
Understood, thank you for this information. I will work on changing "current VI's path" nodes into some of the ideas that you have provided.