Where do I need to copy Python modules to so I can use them in my Python code in Lianja?
Printable View
Where do I need to copy Python modules to so I can use them in my Python code in Lianja?
Please advice on how I can make use of Python to access/determine the serial number of a USB drive.
I am aware that I can make use of microsoft WMI (Windows Management Instrumentation) but I stumble on how to perform the imports of the modules required. The resources I am looking at is http://timgolden.me.uk/python/wmi/index.html This shows need to use pywin32 that is where I can't figure out how to add to Lianja.
Hi Cox,
C:\lianja\scriptinglanguages\python\Lib
This is the path used by python which is setup in the registry when you install Lianja.
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\ PythonPath
C:\lianja\scriptinglanguages\python\Lib;C:\lianja\ scriptinglanguages\python\DLLs;C:\lianja\scripting languages\python\Lib\lib-tk
I am trying to run a for in range loop python as follows via a command
for num in range(5):
Lianja.writeLog(num)
p.s, there is a tab before th Lianja.writeLog.
not getting any output in the log.
running RC10
Hello Cox,
Try it from the python tab in the console workspace.
Hi,
Lianja.writeLog() takes a string.
Regards,
Yvonne
I have managed to gather system details using python & vbscript and during this exercise, found that I did need to make use of modules that are not default in the lianja distribution (hence moved to next solution). Could a breakdown on how this is achieved be put forward please since copying a given directory into the python/lib didn't work for me.
Most of the documentations talked about installing the module to the current python on system, but as a distributed python, couldn't figure this out.
Of interest was pywin32.
http://sourceforge.net/projects/pywin32/
Need: To get unique serial number (Manufacture number) associated with a USB key.
Hi Cox,
I was able to use the msi installer for pywin32, but I had to change a couple of the Registry entries created by the Lianja for Python to do so. (I'll get these checked out for final release.)
I'm on Win64, so I have:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python
on Win32 the root will be (applies to the entries that follow):
HKEY_LOCAL_MACHINE\SOFTWARE\Python
The Lianja installer puts InstallPath here:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\Pyt honCore\InstallPath
but I think it should be one level lower, i.e.
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\Pyt honCore\2.7\InstallPath
and the (Default) string value it contains should be the python folder under Lianja. For a default installation, this is:
C:\Lianja\scriptinglanguages\python\
Also, this:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\Pyt honCore\2.7\InstallPath\InstallGroup
should have the (Default) string value of:
Python 2.7
Regards,
Yvonne
Note: the Forum editor is adding a space in 'PythonCore' - there should be no space.
Please see images, I have made the registry changes as shown,
Attachment 483
and tried to install WMI-1.4.9.win32 (https://pypi.python.org/pypi/WMI/#downloads). as shown in the install pane, the entry for installation directory is as follows (C:\Lianja\scriptinglanguages\python\Lib\site-packages\)
Attachment 484
Have tried at the console to run
import wmi, but getting error
Code:Wed 27. Nov 21:12:30 2013
**** Lianja Python error ****
Traceback (most recent call last):
File "Console" at line 1, in <module>
File "C:\Lianja\scriptinglanguages\python\lib\site-packages\wmi.py" at line 88, in <module>
from win32com.client import GetObject, Dispatch
ImportError: No module named win32com.client
Hi Cox,
It looks like you don't yet have pywin32 installed and wmi sits on top of it. Once you have pywin32 installed, copy the dlls from C:\Lianja\scriptinglanguages\python\Lib\site-packages\pywin32_system32 into your Windows System folder and you should be up and running.
Regards,
Yvonne