Skip to content

Can't translate block to text when using CORGIS w/ a variable argument #116

Open

Description

@thomaswp

The blocks-to-text translations stops working if I use a CORGIS get function with a variable as the argument.

For example, this code works fine...

import airlines

print(airlines.get('Airport.Name','Airport.Code','ATL'))

However, if I use a variable in the airlines.get call, the code can't be translated back to python anymore.

import airlines

code = 'ATL'
print(airlines.get('Airport.Name','Airport.Code',code))

It still run in python, and editing the python updates the blocks, but not vice-versa. The line does turn blue (instead of the brown of a dataset, or of uncompilable code)

image

Stack trace:

Uncaught TypeError: Cannot read properties of undefined (reading 'match')
    at Blockly.Python.finish (bootstrap:52:1)
    at Blockly.Generator.workspaceToCode (blockly.js?4826734f:862:39)
    at BlockMirrorBlockEditor.getCode (blockpy.js:862:21)
    at BlockMirrorBlockEditor.changed (blockpy.js:916:5)
    at Blockly.Workspace.fireChangeListener (blockly.js?4826734f:339:447)
    at Blockly.Events.fireNow_ (blockly.js?4826734f:40:391)
Blockly.Python.finish @ bootstrap:52
Blockly.Generator.workspaceToCode @ blockly.js?4826734f:862
BlockMirrorBlockEditor.getCode @ blockpy.js:862
BlockMirrorBlockEditor.changed @ blockpy.js:916
Blockly.Workspace.fireChangeListener @ blockly.js?4826734f:339
Blockly.Events.fireNow_ @ blockly.js?4826734f:40
setTimeout (async)
Blockly.Events.fire @ blockly.js?4826734f:40
Blockly.BlockDragger.fireDragEndEvent_ @ blockly.js?4826734f:310
Blockly.BlockDragger.endBlockDrag @ blockly.js?4826734f:309
Blockly.Gesture.handleUp @ blockly.js?4826734f:434
Blockly.TouchGesture.handleUp @ blockly.js?4826734f:645
h @ blockly.js?4826734f:780

Since using user input with data is a core learning objective, I often encourage my students to do this, and I don't recall it breaking before, so perhaps this is a new issue?

Activity

  1. thomaswp commented on Dec 15, 2022

    @thomaswp
    Author

    Confirmed this is still an issue on the UDel instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions