Carles Olle Posted October 9, 2013 Share Posted October 9, 2013 Hello, I'm trying to use a python (openpyxl) module in one of the VW scripts. I installed the module as per module author instructions, then I created this script: ------------------------------------------------ from openpyxl import load_workbook from openpyxl import workbook from openpyxl import worksheet wb = load_workbook('mb.xlsm') print(wb.get_sheet_names()) ------------------------------------------------ the script works perfectly when run from command line: C:\>python test.py ['Objects', 'Fields'] but, when I run it from VW menu element, I get this error message window: "Script Error" "Traceback (most recent call last): File "", line 1, in ImportError: No module named 'openpyxl'" I'm sure I'm missing some step but I cannot figure out which one. --Thanks Quote Link to comment
JBenghiat Posted October 9, 2013 Share Posted October 9, 2013 You're running a python build bundled into VW, not the one installed in your OS. In VW, you can specify search paths for external modules, or install the module relative to a plug-in based script. -Josh Quote Link to comment
Miguel Barrera Posted October 9, 2013 Share Posted October 9, 2013 Add the search path to the module by clicking on the menu item "Tools->Plug-ins->Script Options". This will open a dialog to add PYTHONPATH variables. Quote Link to comment
Carles Olle Posted October 11, 2013 Author Share Posted October 11, 2013 That was the missing step! Thanks Quote Link to comment
Dieter @ DWorks Posted October 11, 2013 Share Posted October 11, 2013 (edited) What will happen when a plugin is being encrypted? Will those extra modules be included like px file did, or do we have to deliver those modules with the plugin? And if they aren't included inside the plugin, how can we use self-made modules as our libraries over several plugins effectively? Edited October 11, 2013 by DWorks Quote Link to comment
Dieter @ DWorks Posted October 12, 2013 Share Posted October 12, 2013 I tried some things out, and it seems that importing modules doesn't work with encrypted plug-ins. You will always need to deliver the python scripts and I see now way of protecting the code. Can someone explain how we can protect our code if we want to write python scripts in VW? Encrypting the plugins with px files worked as they just got included into the plugin itself. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.