Bug #60815 Exception in Python workbench shell
Submitted: 9 Apr 2011 11:06 Modified: 20 Jun 2011 19:23
Reporter: Sylvain Plante Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.2.33 OS:Windows (Windows 7 )
Assigned to: CPU Architecture:Any
Tags: exception, execute, python, script, shell

[9 Apr 2011 11:06] Sylvain Plante
Description:
In the process of learning Python, Converting a VB script to Python
The following script raise an exception on execute. It was running fine on the 5.2.30 version

# MySQL Workbench Python script
# <description>
# Written in MySQL Workbench 5.2.30

import grt
#import mforms

SC_Color = ["Almond","Antique White","Brown Derby","Blue Fog","Caribbean Cream","Concrete Gray","Charcoal",
"Chocolate","Coral","Dove Gray","Desert Sand","Dark Walnut","Green Slate","Gray","Ivory","Limestone","Mint",
"MapleWood","Natural White","Old Brick","Putty","RedWood","Sand Buff","Sun Buff","Smoke","Spice","Silver",
"Terra Cotta","Taupe","Tile Red"]
                
SC_ColorAB = ["AL","AW","BD","BF","CC","CG","CL","CH","CO","DG","DS","DW","GS","GY","IV","LS","MT","MW",
"NW","OB","PY","RW","SB","SU","SM","SP","SR","TC","TP","TR"]

SC_Colorant = ["Color Hardener","Color Pack","Eco-Stain","Integral2Color","Powder Release","Solvent Sealer","Veining Color"]

SC_ColorantAB = ["CH","CP","ES","IC","PR","SS","VC"]

#Dim myDb As Database, MySet As Recordset
#Dim RecordNo As Long, ProdName As String, ProdCode As String
#Dim NameIdx As Integer, AbrvIdx As Integer
#Dim Name1Idx As Integer, Abrv1Idx As Integer
#Dim ColorV As Variant, ColorVAB As Variant, ColorantV As Variant, ColorantVAB As Variant

#Set myDb = CurrentDb()
#Set MySet = myDb.OpenRecordset("vtiger_products")

#MySet.MoveFirst

#while true:
if True: # MySet!manufacturer.Value = "Surecrete Design":
	  #ProdName = MySet!ProductName.Value
  for NameIdx, Name in enumerate(SC_Colorant):
		print NameIdx, SC_Colorant[NameIdx]
		
				
#      If InStr(ProdName, ColorantV(NameIdx)) Then
#         For Name1Idx = 1 To UBound(ColorV)
#            If InStr(ProdName, ColorV(Name1Idx)) Then
#               ProdCode = "SC-" & ColorantVAB(NameIdx) & ColorVAB(Name1Idx)
#              Debug.Print "Update ProductCode : " & MySet!ProductCode.Value & " changed to " & ProdCode
#             MySet.Edit
#            MySet!ProductCode.Value = ProdCode
#           MySet.Update
#          Exit For
#     End If
#Next Name1Idx
#          Exit For
#     End If
#Next NameIdx
#    End If
#   MySet.MoveNext
#Loop Until MySet.EOF
#MySet.Close
#End Sub

How to repeat:
Just paste in shell script editor and execute.

Suggested fix:
None yet
[9 Apr 2011 11:09] Sylvain Plante
Made a mistake in first place, level should be S1 instead of S3
[9 Apr 2011 11:34] Sylvain Plante
Found a workaround. Instead of opening the script file, I created a new script file and then pasted the code in it.

My script file was name «Test» with no extension.
[25 May 2011 23:09] Alfredo Kojima
Hi

Can you try with version 5.2.34 and see if the problem persists?
[20 Jun 2011 19:23] Paul DuBois
Noted in 5.2.34 changelog.

In the Python workbench shell, files with a nonsupported execution
generated a warning and could not be run.