# Rough time coming back to Processing

**URL:** <https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375>\
**Category:** Processing.py\
**Created:** [November 23, 2024, 10:20am UTC](https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375 "2024-11-23T10:20:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![slashwreck](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@slashwreck](https://discourse.processing.org/u/slashwreck)\
**Post date:** [November 23, 2024, 10:20am UTC](https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375/1 "2024-11-23T10:20:07Z")

</div>

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.

 ![processing-problem](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/3/5/35308a5b158f1b1b0a1d45a3768a275de984d98a.png)

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.

```auto

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

```

---

<div class="post-metadata">

**Author:** ![slashwreck](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@slashwreck](https://discourse.processing.org/u/slashwreck)\
**Post date:** [November 23, 2024, 11:00am UTC](https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375/3 "2024-11-23T11:00:28Z")

</div>

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.

 ![silent_failures](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/5/e/5e0ea095e4144bdc18e95bd7a1ed3d3aa2091097.png)

---

<div class="post-metadata">

**Author:** ![slashwreck](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@slashwreck](https://discourse.processing.org/u/slashwreck)\
**Post date:** [November 23, 2024, 11:17am UTC](https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375/4 "2024-11-23T11:17:39Z")

</div>

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

 ![2024-11-23_19h17_12](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/2/b/2bf77e5205ec4bfcbdf3dc55e53b8f3ef5b55df6.png)

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 23, 2024, 11:36am UTC](https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375/5 "2024-11-23T11:36:54Z")

</div>

> [@Multiple installs of Processing](https://discourse.processing.org/t/multiple-installs-of-processing/44457/2):
>

> [@I cannot change Sketchbook folder](https://discourse.processing.org/t/i-cannot-change-sketchbook-folder/40629/6):
>
> File "%AppData%\Processing\preferences.txt" is where Processing looks up its configuration. Among them we have properties such as these 3: sketchbook.path= sketchbook.path.three= sketchbook.path.four= Which determines the each “Sketchbook” path for Processing versions 2, 3 & 4 respectively. Again, have utmost care when upgrading Processing to a major version, as not to mix those paths! Otherwise libraries, modes and tools will conflict w/ each other due to major version incompatibility!

> [@Sample code to create SVG file, using Processing 4.1.1 with Python mode](https://discourse.processing.org/t/sample-code-to-create-svg-file-using-processing-4-1-1-with-python-mode/43828/4):
>
> Recently I’ve moved my “processing-3.5.4” app folder from a Win 8.1 laptop to another 1 w/ Win 10 and it works the same. However, b/c you also have Processing 4, you’re gonna need to have separate sketchbook folders for both P3 & P4. Here’s a way to do it on Windows: 1st, close all running Processing instances, so they won’t overwrite the “preferences.txt” file we’re gonna edit later. Go to folder %USERPROFILE%\Documents and create a subfolder named code or another name of your liking. …

---

<div class="post-metadata">

**Author:** ![slashwreck](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@slashwreck](https://discourse.processing.org/u/slashwreck)\
**Post date:** [November 23, 2024, 11:43am UTC](https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375/6 "2024-11-23T11:43:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 23, 2024, 12:17pm UTC](https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375/7 "2024-11-23T12:17:31Z")

</div>

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](https://py5Coding.org)

---

<div class="post-metadata">

**Author:** ![slashwreck](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@slashwreck](https://discourse.processing.org/u/slashwreck)\
**Post date:** [November 23, 2024, 12:36pm UTC](https://discourse.processing.org/t/rough-time-coming-back-to-processing/45375/8 "2024-11-23T12:36:01Z")

</div>

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.
