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
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