Rough time coming back to Processing

I haven’t messed around with Processing for a couple years. The installed version had been 3.5.4. I installed the new 4.3 and tried to run some of my old programs. Inscrutable failures.

I threw away that cache/preferences file from roaming and launch processing.exe --14j-debug

It turns on and some dirt-simple examples work. But trying to open old .pyde files often throw a java crash that kils the entire application.

I copied the code out of one pyde and put it in a new sketch. It fails with some java stuff in the console.

Now I get that I’m trying code from 3.4 in 4.3 and maybe there are some incompatibilities there, but the diagnostics in the console are so inscrutable I’m not sure if the problem is the code, or there is some larger problem going on with my installation etc. So not sure where to begin the debugging process.

But when I try to run any of my old stuff.

Here’s the guts of the pyde I tried to run. But the failure is not unique to it.


add_library('svg')
# xml.etree module
from xml.etree import ElementTree

import random

A = { 0: {'w':841,'h':1188},
     1:{'w':594,'h':841},
     2:{'w':420,'h':594},
     3:{'w':297,'h':420},
     4:{'w':210,'h':297},
     5:{'w':148,'h':210},
     6:{'w':105,'h':148},
     7:{'w':74,'h':105},
     8:{'w':52,'h':74}
     }


DPMM = 96/25.4  # dots per mm  
PAPER_WIDTH_PX = int(A[4]['h']* DPMM)   #A4
PAPER_HEIGHT_PX = int(A[4]['w'] * DPMM)  #A4

BORDER_MARGIN_PX = 1.5 * DPMM

DOC_WIDTH = PAPER_WIDTH_PX - 2 * BORDER_MARGIN_PX
DOC_HEIGHT = PAPER_HEIGHT_PX - 2 * BORDER_MARGIN_PX 

svgs = []


#######################

# CONFIGURATION
OUTPUT_FN = "matchbox.svg"

# MM Measurements

len_outer = 53     *DPMM                   #matchbox X
wid_outer = 35     *DPMM                   #matchbox Y
thick_outer = 15   *DPMM                   #matchbox Z
p = 10*DPMM                                #foldover

len_inner = (len_outer - 3*DPMM)
wid_inner = (wid_outer - 1*DPMM) 
thick_inner = (thick_outer - 2*DPMM)
q = (thick_outer - 1*DPMM)                 #end flap fold line
z = (wid_outer/2 - 1*DPMM)                 #end tab length
x = p+q-z                                  #trimaway section of tab

extension = 10*DPMM                       # extension lines for blueprint

CIRCLE_DIAM = 1.5   # small point layout circles



def settings():
    size(PAPER_WIDTH_PX, PAPER_HEIGHT_PX)



def setup():
    noLoop()

    translate(10*DPMM, 10*DPMM)
    
    # DRAW OUTSIDE DIAGRAM
    
    inkscape_name = ".\\graphics\\outerbox.svg"
    svgs.append(inkscape_name)
    beginRecord(SVG, inkscape_name)
    noFill()

    def outer_square():
        x_coord = 0
        y_coord = 0
        rect_height = 2*wid_outer + 3*thick_outer
        rect(x_coord, y_coord, extension, rect_height)
        
        left=0
        right=extension
        step=0
        for l in [thick_outer,wid_outer, thick_outer, wid_outer]:
            step += l
            line(left, step, right, step)
        
        
            
    pushMatrix()    
    outer_square()
    translate(extension+len_outer,0)
    outer_square()
    resetMatrix()
    #rect(0,0,30,15)
    endRecord()

    
    #DRAW INNER DIAGRAM
    
    inkscape_name = ".\\graphics\\innerbox.svg"
    svgs.append(inkscape_name)
    beginRecord(SVG, inkscape_name)
    noFill()

    translate(120*DPMM, 20*DPMM)
    #rect(0,0,30,30)
    
    def verticals():
        step = 0
        for l in [0, q+p, len_inner, q+p]:
            step += l
            print(step,0,step,extension)
            line(step,0,step,extension)
 
    verticals()
    pushMatrix()
    translate(0,  extension + 2*thick_inner + wid_inner)
    verticals()
    popMatrix()
    #rect(0,0,30,30)
    
    translate(-extension,extension)
    pushMatrix()
    #rect(0,0,40,60)
    
    def horizontals():
        print("-"*15)
        step=0
        for l in [0,thick_inner, wid_inner, thick_inner]:
            step += l
            print(0,step/DPMM, extension/DPMM,step/DPMM)
            line(0,step, extension,step)
            
    horizontals()   #left horizontals
    popMatrix()
    translate(extension + 2*(p+q) + len_inner, 0)
    horizontals()
    translate(-(2*(p+q)+len_inner),0)
    
    
    #tab squares
    xw = q+p-z
    UL = (0,0,xw,thick_inner)
    xoffset = 2*(p+q)+len_inner-xw
    UR = (xoffset,0,xw,thick_inner   )
    LR = (xoffset,(thick_inner+wid_inner),xw,thick_inner   )
    LL = (0,(thick_inner+wid_inner),xw, (thick_inner))
    
    rect(*UL)
    rect(*LL)
    rect(*UR)
    rect(*LR)
 
    #rect(0,0,7,14)
 
 
    #tab folderover lines
    line(p, thick_inner, p, thick_inner+wid_inner)  #left fold line
    xoffset = len_inner+2*(q+p)-p
    line(xoffset, thick_inner , xoffset, thick_inner+wid_inner)  #right fold line
    
    #rect(0,0,7,14)

    #cutting stop points
    UL=(p+q, thick_inner,CIRCLE_DIAM)
    UR=(p+q+len_inner, thick_inner,CIRCLE_DIAM)
    LL=(p+q, thick_inner+wid_inner,CIRCLE_DIAM)
    LR=(p+q+len_inner, thick_inner+wid_inner,CIRCLE_DIAM)
    
    circle(*UL)
    circle(*LL)
    circle(*UR)
    circle(*LR)
 
    endRecord()
 
 
    # create an empty combined.svg file
    beginRecord(SVG, OUTPUT_FN); endRecord()
    ElementTree.register_namespace('', 'http://www.w3.org/2000/svg')
    tree = ElementTree.parse(OUTPUT_FN)
    combined = tree.getroot()
    
    # add the (circles/squares) svgs to the combined.svg file
    for svg in svgs:
        file = ElementTree.parse(svg).getroot()
        group = ElementTree.SubElement(combined, 'g')
        group.set('id', svg)
        group.set('inkscape:groupmode', 'layer')
        group.set('inkscape:label', svg)
        for child in file.getchildren():
            group.append(child)
    
    # save the changes to the combined.svg file
    tree.write(OUTPUT_FN)
    
    
    print("""Try Edit>Select All in All Layers, then ungroup (twice) before running Hershey Text.""")
    print("""Remember to check that all the date columns match""")

Starting from scratch, one thing I notice is that errors or failures just silently fail – nothing goes to the console.

Note that add_library('svg') seems to fail, but no message goes out.

I can simply just try to raise Exception() and nothing appears in the console either.

I threw away the roaming profile again and tried to use my old 3.5.4 installation and that doesn’t work or respond at all. After some time it just throws a meaningless java fault in the console

1 Like

Conclusion to this mess?

I found an old zip of the 3.5.4 install.

Rebooted the machine ( I think there was something java-related that was zombie’d out)

I deleted everything root-and-branch of 4.3, 3.54, and the Roaming profile/preferences directory.

reinstalled 3.5.4 and now my old pyde stuff works again.

Shame on me for mixing versions and causing whatever other java-related mess.

I don’t think there is any need to go to processing 4 if all I’m using is python mode? Looks like it’s the same old python 2-ish dialect?

1 Like

A pity there’s no Processing 3 to 4 migration section instructions.

API wise, there are almost no changes from P3 to P4 anyways.

BtW, you should take a look at py5 project: https://py5Coding.org

3 Likes

oh man, I didn’t know about this!!

Definitely going to migrate. Once I had a taste of using f-strings, it feels like HELL using python-2 syntax.

2 Likes