View Full Version : Lianja App Builder stop working after changes in python file

2016-06-08, 13:47
Hi, 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.

2016-06-08, 16:13
Hi juldou,

Try to get to an earlier saved version. Lianja keeps track of changes.
On the left hand side, click on "Versions", then select your app, and choose an earlier date.
Then click on the counter-clockwise Icon on the top right to "Restore from Backup"

If for some reason that doesnt work, you can open your file in notepad++(or any text editor) and add the closing comment on the caption.
oSection.caption ="This is a custom Python section"

You can find your file in c:\Lianja\apps\<yourappname>\page_section.py


2016-06-08, 23:21
Can I see all the code in the file.

2016-06-09, 00:31
My first thread is all the code.

2016-06-09, 03:12
I understand that but nevertheless can you just paste it here so i can cut and paste it to test why a crash would occur.

2016-06-12, 21:42
Looking at your code... (and 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

3. On my system it does not crash. In fact a Python error is reported in the console.

Mon Jun 13 09:36:35 2016
**** Lianja Python error ****
File "page1_section2.py" at line 63
oSection.caption = "This is a custom Python section
SyntaxError: EOL while scanning string literal

As Herb originally replied, you can open the App Builder and revert to a previous version of any file in the "Versions" workspace.

Clearly it should not crash but I am unable to reproduce this in the version that I am running.

2017-08-10, 17:10
I have the same problem with Windows 10, 64bits, Lianja 3.4, Visual Fox Gadget. This is the code of the gadget who crash the IDE with any kind of code:
define class Seleccion as Commandbutton
procedure click(id)

//a=messagebox("Hola Mundo")
select employees
proc gadget2
gadget2 = createobject("gadget2")
// Create your section UI from the application framework classes here
// e.g. to add a tabbed section:
// gadget2.addobject("tabs", "pageframe")
// tabs.addobject("tab1", "page")
// tab1.caption = "Customers"
// tabs.addobject("tab2", "page")
// tab2.caption = "Orders"
// tabs.addobject("tab3", "page")
// tab3.caption = "Shippers"


return gadget2

2017-08-10, 17:42

Updating this:

In Lianja, you would use define and endDefine for classes, not endclass.