Posted: 2017-01-21 in Python

I have the module in that deployment folder (.py in the Lib folder and .pyd in the DLLs folder) yet the app still breaks on the “import xyz” line in my app when not run through the app builder.
check that any modules required by your xyz module are also installed on the deployment target machine.

where to put python DLLs (.pyd) that are called in python modules we want to import? I’ve tried putting them in both …/Lianja/scriptinglanguages/python/DLLs and in …/Lianja/scriptinglanguages/python/Lib. In the “Using Python Modules” thread on here it mentions registry key editing and I’ve followed those instructions as well. What is happening now is:

  • I have a python DLL “mydll.pyd” in the 2 folders mentioned above
  • I have a script “” in …/Lianja/scriptinglanguages/python/Lib which has at the top:


import mydll

When I runCode:

import myscript

in the Lianja Python console, it pops out:

**** Lianja Python error ****
Traceback (most recent call last):
  File "Console" at line 1, in <module>
  File "C:\lianja\scriptinglanguages\python\lib\" at line 7, in <module>
    import mydll
ImportError: DLL load failed: The specified module could not be found.

If the python DLL has been built against the version of Python supported in Lianja (which is 2.7 on windows) it works by just placing the DLL in the DLL directory.
You can verify this from the Python console.

import sqlite3

where sqlite3.dll exists in C:\lianja\scriptinglanguages\python\DLLs
If you exit Lianja and rename the sqllite3.dll to xxx_sqlite3.dll and then run Lianja again and do the same sequence of steps the DLL will not be found.
The DLL must be a 32-bit DLL not a 64-bit version, and it must be compatible with Python 2.7.

how python imports work when deploying desktop apps? I assume I have to put the imported .py and .pyd files somewhere on the client system in a similar place to where I have them on the dev system. I’ve tried putting them in the same place (lianja/scriptinglanguages/python) and in cloudserver/scriptingilanguages/python.
The deployment path for Python modules is:


The development path for Python modules is:


The drive letter where the exe is run from is prefixed onto it and replaces C:
After deploying look in file explorer and make sure the files are indeed in the place you expect them to be.

it told me I had the wrong version of python installed. So I uninstalled my Python 3.5 and installed Python 2.7, the same version Lianja uses.
it seems to be an issue with the way node.js structures its directories. I had a look through the phonegap directory tree on the computer we have with phonegap working and it doesn’t seem to have “node_modules\bufferutil” or “node_modules\utf-8-validate”, it goes straight from “ws” to “build”. Without those folders the entire path is just barely under the Windows character limit for a folder name, with them it’s just barely over.
Do you know how to get around this or why it’s putting those two folders in?
Lianja is not using those folders. It seems you installed visual studio with PhoneGap tools and it has basically messed up any ability to install PhoneGap and node.js for use with Lianja.
It’s the path that visual studio has setup for node.js. It’s too long as stated in the error messages
It’s highly likely that visual studio has custom versions of PhoneGap and node.js installed that prevent it being used by other products.
Yep that was it, I uninstalled Visual Studio and reinstalled Lianja and now everything works

I have problem about Lianja App Builder.
Sometimes to often my App Builder stop working immediately after changing my python file a switching from Apps to Pages.
I’m using Windows 7 32 bit and Lianja full download with all services, but Trial.
I’m going to add some code below to check if my code isn’t bad.
Before my Lianja stopped working, I had the following code:

# Lianja custom Python section "page1_section1"
import Lianja
# Step 1: Define the classes we need
# Note that all Lianja UI Framework classes can be subclassed in Python
class mySection(Lianja.Section):
    def add(self):
        Lianja.showMessage("add() was called")
    def delete(self):
        Lianja.showMessage("delete() was called")
    def first(self):
        Lianja.showMessage("first() was called")
    def previous(self):
        Lianja.showMessage("previous() was called")
    def next(self):
        Lianja.showMessage("next() was called")
    def last(self):
        Lianja.showMessage("last() was called")
    def refresh(self):
    def search(self):
    def watch(self):
        Lianja.showMessage("watch() was called")
    def edit(self):
        Lianja.showMessage("edit() was called")
    def save(self):
        Lianja.showMessage("save() was called")
    def cancel(self):
        Lianja.showMessage("cancel() was called")
# Note how the click() event handler for the ListBox is defined in Python
class myListbox(Lianja.Listbox):
    def click(self):
        ui_grid.clear( )
        # Note how the AddItems method of Grid, ListBox and ComboBox can take 
        # a SQL SELECT statement as an argument
        if ui_listbox.text == "All":
            ui_grid.additems('select * from southwind!example where last_name != " "')
            ui_grid.additems('select * from southwind!example where upper(left(last_name,1)) \
            = "' + ui_listbox.text + '"')
        ui_grid.refresh( )

This works when I changed from Apps to Pages.
But when I added following lines of code, my Lianja stop working, and after restart I cannot access my App, It stop working again and again..

# Step 2: Create the Section object
# Note that the CreateObject() method needs two args: objectname, classname
oSection = Lianja.createObject("oSection", "mySection")
oSection.backcolor = "lightgreen"
oSection.caption = "This is a custom Python section

Stop working means Windows pop-up dialog stop working, and just one way is to close the app.
The reason I asked you to cut and paste the code is that Python syntax is all based on whitespace indentation.
1. oSection.caption = “This is a custom Python section

This is missing a closing quote.

2. This is not a valid custom section as you have removed this code that was generated for you and is required.

oSection = Lianja.createObject("oSection", "mySection")
returnvalue = oSection

you will see some Python sections and gadgets in the pages menu. Select the python section, then click the little keyboard icon in the section header to edit/view the code.

The developers guide on the Lianja website has documentation on how to use Python to build custom sections and custom gadgets.…velopers_Guide

I have problem about debugging in Python. When I click Open file in debugger, it says: “You cannot run the debugger on this type of file.”
It is possible to debug in python?
No the debugger is for Lianja/VFP code only.

I have a file in my application called
I would like to call it from a Custom VFP section.
I have tried execPython(“”), but that is not calling it.
once I loaded the file using loadlibrary(), all of my python functions are working using execPython(“functionName()”).

in Lianja 3.1 the execPython( expr ), execPHP( expr ) and execJavaScript( expr ) Lianja/VFP functions return the result of the executed code. This makes it simple to integrate Lianja/VFP with Python/PHP/JavaScript. If expr is a filename it it loaded and executed.

And also just to remind you.

1. In Python, PHP and JavaScript you can call Lianja.evaluate( expr ) to call back into Lianja/VFP.
2. The Lianja/VFP loadLibrary( filename ) function can load Python (.py), PHP (.php) and JavaScript (.js) libraries too.

This works fine in my application.

for i in range(1,20):
        <one tab Here>Lianja.console(str(i))

But it looks like the it is not picking up both lines when I try to test it in the app inspector or console.
You can only issue single-line commands in the Console/App Inspector Command Windows.

I have a migration process to Lianja occurring in stages.
But the data will be live I Lianja from Day 1.
I need the rest of the applications to be able to read the data from python until they are all moved over.
I am testing out how best to access the Lianja databases from outside Python code.
To test, I have configured the Lianja ODBC connection “Lianja_Soutwind” and successfully tested the connection.
However, I am unable to connect using pyodbc.
Is there a different, recommended way I should be connecting to Lianja?

We have an internal team at the Fund that uses Python a lot. I am trying to show them the light of Lianja
So for now, I do need to test both the code in Lianja and from the current external install.
You would appear to be using your own Python installation which is probably x64 rather than the python we provide that is also embedded in Lianja.
As per the error message you have a x64 and x86 mismatch of drivers.

You dont need QT to build full database interactive openCV applications.
By usings Lianja python and native database support, you can extend opencv easier than you ever thought possible.
Lianja openCV threshold part 1 –

Taking the C++ threshold example, building it in python, then extending it as a web application using Lianja.
Lianja openCV threshold part 2 –

Using the robust Lianja framework with python/OpenCV, we build an application that converts any image to a pencil sketch.
openCVLIanja –

Just did a quick and dirty demo of Python with newest Data Aware IDE/Platform on the Market called Lianja.
I have been developing apps for over 20 years and just started with Python.
I have used the Lianja product for a couple years now building desktop, web and mobile apps.
It’s fairly new, but makes developing data aware applications simple.
Python LIanja Intro –


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s