jupyterlab / jupyterlab

JupyterLab computational environment.
https://jupyterlab.readthedocs.io/
Other
13.87k stars 3.15k forks source link

Editor writes inserted text to different in-file location than displayed #2951

Open dr-1 opened 6 years ago

dr-1 commented 6 years ago

When editing a file with the integrated editor, new text occasionally gets written somewhere else in the file than what is shown on screen. For example, when I add a function to the end of a script it may actually be written further up in the file, in the middle of a line, as confirmed by viewing the file in other editors. The JupyterLab editor will show the new text in the intended location even after closing and re-opening the file.

I am not able to reproduce this behavior but notice it crops up from time to time. Perhaps others have more insight into when and why this happens.

blink1073 commented 6 years ago

Hi @dr-1, we have heard of this happening one other time, but we weren't able to track down the cause.

If it happens again, can you open your browser's JavaScript console and look for any errors? We added this debug output in light of the last report.

dr-1 commented 6 years ago

When it happened yesterday I was editing a Python script

No google-drive extension. The file was open in one pane only. I had several other editor tabs open to edit other files, as well as a notebook pane to run the script.

I will keep an eye on it and check the output in the JavaScript console.

aeroaks commented 6 years ago

Experienced the same issue here:

running within virtual env with Python 3.5.3

blink1073 commented 6 years ago

I still haven't been able to reproduce, but https://github.com/jupyterlab/jupyterlab/pull/2967 makes it easier to report when something goes wrong.

aeroaks commented 6 years ago

Original file: image

Edited using the text editor: (Changed 'size' in class Chipdesign) image

When checking the text file using external editor: image

Hope this helps!!

blink1073 commented 6 years ago

Hi @aeroaks, can you please paste those file contents here (or paste a link) so I can try them?

aeroaks commented 6 years ago
from peewee import *
from playhouse.postgres_ext import *
from playhouse.postgres_ext import PostgresqlExtDatabase

database = PostgresqlExtDatabase('test', **{'host': '127.0.0.1', 'port': 5432, 'password': 'pass', 'user': 'postgres'}, register_hstore=False)

class UnknownField(object):
    def __init__(self, *_, **__): pass

class BaseModel(Model):
    class Meta:
        database = database

class Chipdesign(BaseModel):
    name = CharField()
    size = BinaryJSONField()

    class Meta:
        db_table = 'chipdesign'

class Chip(BaseModel):
    chipdesign = ForeignKeyField(db_column='chipdesign_id', rel_model=Chipdesign, to_field='id')
    name = CharField()
    overview = BinaryJSONField(null=True)
    param = BinaryJSONField(null=True)

    class Meta:
        db_table = 'chip'

Contents copied from external editor Notepad++ on WIndows.

blink1073 commented 6 years ago

Progress, thanks @aeroaks! It looks like a line endings issue. I reproduce the error on Windows 10 by making sure the above file has CRLF line endings.

blink1073 commented 6 years ago

Although it does not explain the error happening on Linux, which should have the LF endings that CodeMirror expects.

sccolbert commented 6 years ago

A file on linux can still have CRLF endings, especially if its from a git repo with multiple contributors.

dr-1 commented 6 years ago

I can confirm the line ending issue. On Linux, when I convert line endings of a file to CRLF and then edit it in the JupyterLab editor, the error occurs and Chrome's JavaScript console shows the "Uh oh, the string model is out of sync:" error message.

timvink commented 6 years ago

I have the same issue. Lines are 'scrambled' after saving + reopening text file in JupyterLab.

I was able to fully resolve the problem by removing windows line endings (^M) with:

sed -i 's/^M$//' <filename> # for the special ^M char, use CTRL+V then CTRL+M
ghost commented 6 years ago
{"model":"var webdriverio = require('webdriverio');\nvar sync = require('wdio-sync')\nvar fs = require('fs');\nvar importer = require('../Core');\nvar path = require('path');\nvar TIMEOUT = 10000;\nvar TOKEN_DIR = path.join(process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE, '.credentials');\nvar SESSIONS_PATH = path.join(TOKEN_DIR, 'sessions.json');\nvar sessions;\nvar sessionModified;\nvar getSessions = () => {\n    try {\n        sessionModified = fs.statSync(SESSIONS_PATH).mtime.getTime();\n        sessions = JSON.parse(fs.readFileSync(SESSIONS_PATH)\n            .toString());\n    } catch (e) {\n        sessions = {};\n    }\n\n    if(typeof sessions.inactive === 'undefined') {\n        sessions.inactive = [];\n    }\n    if(typeof sessions.active === 'undefined') {\n        sessions.active = [];\n    }\n    return sessions;\n};\n\nvar updateOrAddSession = (currentSession) => {\n    if(fs.existSync(fs.statSync(SESSIONS_PATH))\n       && fs.statSync(SESSIONS_PATH).mtime.getTime() > sessionModified) {\n        getSessions();\n    }\n    const updateSession = sessions.active.filter(s => s[1] === currentSession)[0];\n    if(typeof updateSession !== 'undefined') {\n        if((new Date()).getTime() - updateSession[0] > TIMEOUT / 2) {\n            updateSession[0] = (new Date()).getTime();\n        } else {\n            return;\n        }\n    } else {\n        sessions.active.push([(new Date()).getTime(), currentSession]);\n    }\n    fs.writeFileSync(\n        SESSIONS_PATH,\n        JSON.stringify(sessions, null, 4))\n}\n\nvar sessionSync = false;\nvar createWebdriverClient = (host, port) => {\n    if(sessionSync) {\n        return new Promise(resolve => setTimeout(() => resolve(), 100))\n            .then(() => createWebdriverClient(host, port));\n    }\n    sessionSync = true;\n    const sessions = getSessions();\n    \n    var webdriverServer = {\n        sync: true,\n        debug: true,\n        host: host || 'localhost',\n        port: port || 4444,\n        logLevel: 'debug',\n        baseUrl: 'https://webdriver.io',\n        pageLoadStrategy: 'eager',\n        connectionRetryTimeout: TIMEOUT,\n        desiredCapabilities: {\n            browserName: 'chrome',\n            chromeOptions: {\n                prefs: {\n                    'download.default_directory': '/data/downloads',\n                    'profile.default_content_setting_values.notifications': 2,\n                    'exited_cleanly': true,\n                    'exit_type': 'None'\n                },\n                args: [\n                    // TODO: https://superuser.com/questions/461035/disable-google-chrome-session-restore-functionality\n                    'user-data-dir=/tmp/profile-' + sessions.active.length,\n                    // 'start-fullscreen',\n                    'no-sandbox',\n                    'disable-session-crashed-bubble',\n                    'disable-infobars',\n                    'new-window',\n                    'disable-geolocation',\n                    'disable-notifications',\n                    'show-saved-copy',\n                    'silent-debugger-extension-api'\n                    //'kiosk'\n                ]\n            }\n        },\n    };\n    \n    console.log('Initializing webdriver on ' + webdriverServer.host);\n    var client = webdriverio.remote(webdriverServer);\n    sync.wrapCommands(client, [], []);\n    client.$ = (...config) => client.element.apply(client, config)\n    client.$$ = (...config) => client.elements.apply(client, config).value\n    client.on('error', function (e) {\n        console.log(e);\n        this.endAll();\n    });\n    client.on('end', function () {\n        console.log('Daemon: Closing browser');\n    });\n    client.on('result', function (result) {\n        updateOrAddSession(client.requestHandler.sessionID);\n        //console.log(result);\n    });\n    return client\n        .then(() => {\n            // validate and close each session\n            const inactive = sessions.inactive.concat(sessions.active.filter(session => \n                    // reuse if lagging longer than 120 seconds?\n                    (new Date()).getTime() - session[0] > TIMEOUT))\n            \n            return importer.runAllPromises(inactive.map(session => (resolve) => {\n                client.requestHandler.sessionID = session[1];\n                client.session()\n                    .then(s => resolve(s.sessionId))\n                    .catch(e => resolve(null));\n            }))\n                .then(r => r\n                    .filter(sess => typeof sess !== 'undefined' && sess !== null)\n                    .filter((elem, pos, arr) => arr.indexOf(elem) === pos))\n        })\n        // save current session\n        .then(validSessions => {\n            console.log(validSessions);\n            if (validSessions.length == 0) {\n                // save new session\n                client.requestHandler.sessionID = null;\n                // TODO: fix this, doesn't work on second init, keeps opening new windows\n                return client.init();\n            } else {\n                // set to first valid\n                client.requestHandler.sessionID = validSessions[0];\n            }\n        })\n        .then(res => {\n            updateOrAddSession(client.requestHandler.sessionID);\n            return importer.import([\n                'resize selenium window',\n                'only one window'], {\n                client,\n                OFFSET: sessions.active.map(s => s[1])\n                                             .indexOf(client.requestHandler.sessionID) * 9})\n        })\n        .then(r => r[1]())\n        /*\n        .then(() => client.requestHandler.create({\n            path: '/status',\n            method: 'GET'\n        }))\n        */\n        .catch(e => console.log(e))\n        // Down here at the bottom for safetey\n        .then(() => sessionSync = false)\n};\nmodule.exports = createWebdriverClient;\ncreateWebdriverClient;\n\n\r","view":"var webdriverio = require('webdriverio');\nvar sync = require('wdio-sync')\nvar fs = require('fs');\nvar importer = require('../Core');\nvar path = require('path');\nvar TIMEOUT = 10000;\nvar TOKEN_DIR = path.join(process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE, '.credentials');\nvar SESSIONS_PATH = path.join(TOKEN_DIR, 'sessions.json');\nvar sessions;\nvar sessionModified;\nvar getSessions = () => {\n    try {\n        sessionModified = fs.statSync(SESSIONS_PATH).mtime.getTime();\n        sessions = JSON.parse(fs.readFileSync(SESSIONS_PATH)\n            .toString());\n    } catch (e) {\n        sessions = {};\n    }\n\n    if(typeof sessions.inactive === 'undefined') {\n        sessions.inactive = [];\n    }\n    if(typeof sessions.active === 'undefined') {\n        sessions.active = [];\n    }\n    return sessions;\n};\n\nvar updateOrAddSession = (currentSession) => {\n    if(fs.existSync(fs.statSync(SESSIONS_PATH))\n       && fs.statSync(SESSIONS_PATH).mtime.getTime() > sessionModified) {\n        getSessions();\n    }\n    const updateSession = sessions.active.filter(s => s[1] === currentSession)[0];\n    if(typeof updateSession !== 'undefined') {\n        if((new Date()).getTime() - updateSession[0] > TIMEOUT / 2) {\n            updateSession[0] = (new Date()).getTime();\n        } else {\n            return;\n        }\n    } else {\n        sessions.active.push([(new Date()).getTime(), currentSession]);\n    }\n    fs.writeFileSync(\n        SESSIONS_PATH,\n        JSON.stringify(sessions, null, 4))\n}\n\nvar sessionSync = false;\nvar createWebdriverClient = (host, port) => {\n    if(sessionSync) {\n        return new Promise(resolve => setTimeout(() => resolve(), 100))\n            .then(() => createWebdriverClient(host, port));\n    }\n    sessionSync = true;\n    const sessions = getSessions();\n    \n    var webdriverServer = {\n        sync: true,\n        debug: true,\n        host: host || 'localhost',\n        port: port || 4444,\n        logLevel: 'debug',\n        baseUrl: 'https://webdriver.io',\n        pageLoadStrategy: 'eager',\n        connectionRetryTimeout: TIMEOUT,\n        desiredCapabilities: {\n            browserName: 'chrome',\n            chromeOptions: {\n                prefs: {\n                    'download.default_directory': '/data/downloads',\n                    'profile.default_content_setting_values.notifications': 2,\n                    'exited_cleanly': true,\n                    'exit_type': 'None'\n                },\n                args: [\n                    // TODO: https://superuser.com/questions/461035/disable-google-chrome-session-restore-functionality\n                    'user-data-dir=/tmp/profile-' + sessions.active.length,\n                    // 'start-fullscreen',\n                    'no-sandbox',\n                    'disable-session-crashed-bubble',\n                    'disable-infobars',\n                    'new-window',\n                    'disable-geolocation',\n                    'disable-notifications',\n                    'show-saved-copy',\n                    'silent-debugger-extension-api'\n                    //'kiosk'\n                ]\n            }\n        },\n    };\n    \n    console.log('Initializing webdriver on ' + webdriverServer.host);\n    var client = webdriverio.remote(webdriverServer);\n    sync.wrapCommands(client, [], []);\n    client.$ = (...config) => client.element.apply(client, config)\n    client.$$ = (...config) => client.elements.apply(client, config).value\n    client.on('error', function (e) {\n        console.log(e);\n        this.endAll();\n    });\n    client.on('end', function () {\n        console.log('Daemon: Closing browser');\n    });\n    client.on('result', function (result) {\n        updateOrAddSession(client.requestHandler.sessionID);\n        //console.log(result);\n    });\n    return client\n        .then(() => {\n            // validate and close each session\n            const inactive = sessions.inactive.concat(sessions.active.filter(session => \n                    // reuse if lagging longer than 120 seconds?\n                    (new Date()).getTime() - session[0] > TIMEOUT))\n            \n            return importer.runAllPromises(inactive.map(session => (resolve) => {\n                client.requestHandler.sessionID = session[1];\n                client.session()\n                    .then(s => resolve(s.sessionId))\n                    .catch(e => resolve(null));\n            }))\n                .then(r => r\n                    .filter(sess => typeof sess !== 'undefined' && sess !== null)\n                    .filter((elem, pos, arr) => arr.indexOf(elem) === pos))\n        })\n        // save current session\n        .then(validSessions => {\n            console.log(validSessions);\n            if (validSessions.length == 0) {\n                // save new session\n                client.requestHandler.sessionID = null;\n                // TODO: fix this, doesn't work on second init, keeps opening new windows\n                return client.init();\n            } else {\n                // set to first valid\n                client.requestHandler.sessionID = validSessions[0];\n            }\n        })\n        .then(res => {\n            updateOrAddSession(client.requestHandler.sessionID);\n            return importer.import([\n                'resize selenium window',\n                'only one window'], {\n                client,\n                OFFSET: sessions.active.map(s => s[1])\n                                             .indexOf(client.requestHandler.sessionID) * 9})\n        })\n        .then(r => r[1]())\n        /*\n        .then(() => client.requestHandler.create({\n            path: '/status',\n            method: 'GET'\n        }))\n        */\n        .catch(e => console.log(e))\n        // Down here at the bottom for safetey\n        .then(() => sessionSync = false)\n};\nmodule.exports = createWebdriverClient;\ncreateWebdriverClient;\n\n\n","selections":[{"uuid":"1b8481a0b85612356e1d62ca0a924cd4","start":{"line":30,"column":10},"end":{"line":30,"column":10},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":30,"column":10},"lineSep":null,"mode":"text/javascript","change":{"from":{"line":30,"ch":9,"sticky":null},"to":{"line":30,"ch":9,"sticky":null},"text":[" "],"origin":"+input","removed":[""]}}
ghost commented 6 years ago

Must have something to do with special characters. I somehow got a bunch of hidden delete characters in my cells. When I would try to run and it errors out with the syntax error it shows missing characters where the errors is. I cut and paste as plain text and the issue goes away.

blink1073 commented 6 years ago

Hi @megamindbrian, do you have the original file? If you save it as TXT, you can drop it into the comment box here.

ghost commented 6 years ago

interpret questions.txt

blink1073 commented 6 years ago

Thanks! However, I wasn't able to reproduce the bug with that file. What version of JupyterLab, and which OS and browser are you using?

ghost commented 6 years ago

Using Windows and Mac. Windows line endings are \n\r and Mac is just \r This popup is so awful doing some reformatting I might have to switch editors.

ghost commented 6 years ago

I take that back. Doing a find and replace for \r", and replacing \n", appears to have worked.

theloni-monk commented 6 years ago

I'm on windows 10 using the latest version of Chrome with the lastest Jupyter Lab version

and I just ran into the same issue while editing a python file, but doing the find and replace did not fix it.

ghost commented 6 years ago

I realized there are more find and replaces, "\r" with "\n", or \r\n" with \n". I didn't run into any problems editing .ipynb files directly, but if it doesn't open you may want to repair it by changing the extension to .json. Make backups.

I am pretty convinced it has something to do with the \r character. It started to clear up once they were all removed.

On Sat, Nov 11, 2017 at 8:45 AM, thatguy1234510 notifications@github.com wrote:

I'm on windows 10 using the latest version of Chrome and I just ran into the same issue, but doing the find and replace did not fix it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jupyterlab/jupyterlab/issues/2951#issuecomment-343673746, or mute the thread https://github.com/notifications/unsubscribe-auth/AX5XbjNjyPGq8YyvRxFck8L_VGWXReC5ks5s1cETgaJpZM4PIfcv .

-- CONFIDENTIALITY NOTICE: The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. It is then shared with tech companies, bots, hackers, government agencies, and marketers. The security of this message is none, and it may be shared on Instagram at anytime. If you are OK with this, please respond. There isn't really any security or privacy anywhere. If you disagree you may want to go camping and talk to people face-to-face like in old times.

theloni-monk commented 6 years ago

I think you are right, I just restarted my computer, and replaced all the \r with \n, and the code appears to be behaving normally after editing.

eastmancr commented 5 years ago

To be honest, I just installed this and an error popped up and it told me to post this here.

{"model":"# %load test.py\ndef main():\n print(\"ok\")\n\nmain()","view":"%loadpy test.py\n","selections":[{"uuid":"520f32b819df7b7baf20944918ea8dbe","start":{"line":1,"column":0},"end":{"line":1,"column":0},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":1,"column":0},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":0,"ch":15,"sticky":null},"to":{"line":0,"ch":15,"sticky":null},"text":["",""],"origin":"+input","removed":[""]}}

denised commented 5 years ago

I just ran into this and got the instructions to post the following debug info here. In my case, I am not using the jupyterlab editor, I was using %load magic, when the error happened. Jupyterlab version 0.34.8.

{"model":"# %load analyze.py\nimport torch\nimport re\n\n\"\"\"Analytical tools for understanding or debugging pytorch convolutional models\"\"\"\n\ndef name_your_children(module):\n \"\"\"Adds a node's name to its state, so we can use it later\"\"\"\n for n, c in module.named_children():\n setattr(c,'mynameis',n)\n\n\ndef show_dataflow(ann, sample, pattern=''):\n \"\"\"Show the size of the input/output parameters throughout the network, for an input of a given size.\n sample is a sample input to use, and should be the expected size of a minibatch input to the network.\n The pattern parameter can be used to filter the nodes which are shown; it is a regexp that matches \n the type of the node (e.g. 'Conv2D') or its name (e.g. 'conv1'). By default all nodes are shown.\"\"\"\n\n indent = [''] # indentation in an array so it can be modified by the subroutines below\n\n def show_dataflow_pre(module, inp):\n mynameis = (module.mynameis if hasattr(module,'mynameis') else '')\n print(indent[0], [x.shape for x in inp])\n if mynameis:\n print(indent[0], mynameis, ': ', module)\n else:\n print(indent[0], module)\n indent[0] = indent[0] + ' '\n\n def show_dataflow_post(module, inp, outp):\n indent[0] = indent[0][:-2]\n print(indent[0], outp.shape)\n print('')\n\n hooks = []\n ann.apply(name_your_children)\n ann.apply(lambda mod:\n (re.search(pattern, type(mod).name) or (hasattr(mod,'mynameis') and re.search(pattern, mod.mynameis))) and\n hooks.append(mod.register_forward_pre_hook(show_dataflow_pre)) and\n hooks.append(mod_register_forward_hook(show_dataflow_post)))\n\n try:\n ann.eval()\n ann.forward(sample)\n finally:\n for hook in hooks:\n hook.remove()\n\n","view":"%load analyze.py","selections":[{"uuid":"f03e58fb-5be5-45ad-9a24-b2a9f9eb3174","start":{"line":0,"column":16},"end":{"line":0,"column":16},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":16},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":0,"ch":15,"sticky":null},"to":{"line":0,"ch":15,"sticky":null},"text":["y"],"origin":"+input","removed":[""]}}

jgbustos commented 5 years ago

Hi

Please see data I just got from my browser console:

{"model":"Scilab version \"6.0.1.1518683525\"\r\nscilab-6.0.1\r\n\r\n","view":"Scilab version \"6.0.1.1518683525\"\nscilab-6.0.1\n\n","selections":[{"uuid":"d82b7c8b-53c1-4f6d-81b6-1ebf1bcea4d8","start":{"line":0,"column":0},"end":{"line":0,"column":0},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":0},"lineSep":null,"mode":"text/plain","change":{"from":{"line":0,"ch":0,"sticky":null},"to":{"line":0,"ch":3,"sticky":null},"text":["Scilab version \"6.0.1.1518683525\"","scilab-6.0.1","",""],"origin":"setValue","removed":["..."]}}

Thanks,

JGB

jasongrout commented 5 years ago

Fixed in #5622. Thanks @ian-r-rose!

gegnew commented 5 years ago

Hi,

bug report from browser console, as prompted:

{"model":"db['Sample ID']str.split","view":"db['Sample ID']str.split?","selections":[{"uuid":"1f096143-7f5a-48a3-a0ac-1030f7323930","start":{"line":0,"column":19},"end":{"line":0,"column":19},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":19},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":0,"ch":18,"sticky":null},"to":{"line":0,"ch":18,"sticky":null},"text":["."],"origin":"+input","removed":[""]}}

ngharrison commented 5 years ago

Error occurred for me when using a console attached to a .py file:

{"model":"kp[0].class_id","view":"kp[0].class_id?","selections":[{"uuid":"b27fae79-6270-4d97-b21a-309859f72e63","start":{"line":0,"column":15},"end":{"line":0,"column":15},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":15},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":0,"ch":14,"sticky":null},"to":{"line":0,"ch":14,"sticky":null},"text":["?"],"origin":"+input","removed":[""]}}

YubinXie commented 5 years ago

Error occurred in jupyter lab notebook interface.

{"model":"rle_images = sorted(glob.glob(\n '/Users/xie/GoogleDrive/Projects/Mask-RCNN/Mask_RCNN-master-TF-2019-3-26/samples/lung/panel18_s3_final_output-512/Lung_Panel18_RGB_final_s3/.tif'\r ) )\n\n","view":"rle_images = sorted(glob.glob(\n '/Users/xie/GoogleDrive/Projects/Mask-RCNN/Mask_RCNN-master-TF-2019-3-26/samples/lung/panel18_s3_final_output-512/Lung_Panel18_RGB_final_s3/.tif'\n ) )\n\n","selections":[{"uuid":"a847d25a-33c0-456a-82a7-f9ffb7f2d46a","start":{"line":1,"column":158},"end":{"line":1,"column":158},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":1,"column":158},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":1,"ch":157,"sticky":"before","xRel":42.2249755859375},"to":{"line":1,"ch":157,"sticky":"before","xRel":42.2249755859375},"text":["'"],"origin":"+input","removed":[""]}}

jasongrout commented 5 years ago

For those that saw this recently, can you try with the latest prerelease, 1.0a3, and see if it is still an issue. It should have been fixed in 1.0a0.

kellington commented 5 years ago

Code Editor out of Sync

jupyter --version 4.4.0

{"model":"sql1 = \"\"\"SELECT \r\n sum(heap_blks_read) as heap_read,\r\n sum(heap_blks_hit) as heap_hit,\r\n sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) as ratio\r\nFROM \r\n pg_st \"\"\"bles;","view":"sql1 = \"\"\"SELECT \n sum(heap_blks_read) as heap_read,\n sum(heap_blks_hit) as heap_hit,\n sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) as ratio\nFROM \n pg_statitables;","selections":[{"uuid":"f670682911837dff3dc384ad6860823c","start":{"line":5,"column":12},"end":{"line":5,"column":12},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":5,"column":12},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":5,"ch":12,"sticky":null},"to":{"line":6,"ch":7,"sticky":null},"text":[""],"removed":[""," \"\"\""]}}

jasongrout commented 5 years ago

What version of JupyterLab do you have?

kellington commented 5 years ago

jupyter --version 4.4.0

jupyter lab --version 0.32.1

jupyter notebook --version 5.4.0

kellington commented 5 years ago

Jason - unfortunately, I can't recreate it right now - I deleted the notebook I was working - wasn't thinking it would be useful.

jasongrout commented 5 years ago

jupyter lab --version 0.32.1

That is a very old version of JupyterLab at this point. This issue should have been fixed in newer versions. I'd suggest upgrading to 0.35.x.

jasongrout commented 5 years ago

Actually, looking at the PR that fixed this issue above, this was fixed in 1.0a1. I'd suggest upgrading to 1.0a3 if you can, or waiting until 1.0 (which should be fairly soon).

wongjoel commented 4 years ago

I realize this issue is closed, but I was directed to this issue directly by an error message from running an ipython console in jupyter lab.

Browser console output below: from editor.js:888

Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951

from editor.js:889

{"model":"# %load hello.py\nprint(\"hello_world\")","view":"%load hello.py","selections":[{"uuid":"b3e4741c-c097-41db-9b35-d1fa45954dae","start":{"line":0,"column":14},"end":{"line":0,"column":14},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":14},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":0,"ch":14,"sticky":"before"},"to":{"line":1,"ch":0,"sticky":null},"text":[""],"origin":"+delete","removed":["",""]}}

Steps taken to reproduce

  1. Make a new text file with jupyter lab, rename to hello.py
    print("hello_world")
  2. Open a python3 console in jupyer lab
  3. Run %load hello.py
  4. A pop up appears, with the message Code Editor out of Sync. Please open your browser JavaScript console for bug report instructions

    Operating Environment

    Jupyter lab version: 1.0.4

    jupyter lab --version
    1.0.4

    OS: Ubuntu 19.04

    > lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 19.04
    Release:    19.04
    Codename:   disco

    Browser: Firefox Quantum 68.0.1 (64-bit)

vogelsgesang commented 4 years ago

I also hit this issue in JupyterLab 1.0.4.

output on the dev console:

[Log] Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951 (vendors~main.f9d51a2ef8d665e3d317.js, line 378257)
[Log] {"model":"SELECT * FROM GENERATE_SERIES(1,10)","view":"\\load test.sql","selections":[{"uuid":"374bf080-e1e1-4e8c-a112-96849b125dec","start":{"line":0,"column":14},"end":{"line":0,"column":14},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":14},"lineSep":null,"mode":"text/x-sql","change":{"from":{"line":0,"ch":13,"sticky":null},"to":{"line":0,"ch":13,"sticky":null},"text":["l"],"origin":"+input","removed":[""]}} (vendors~main.f9d51a2ef8d665e3d317.js, line 378258)

Similar repro as described by @wongjoel: I just executed a \load (which is the equivalent for %load in this kernel) on a console. Executing \load in a notebook works fine

TRM13 commented 4 years ago

Update: When I had these 3 lines in one code cell the third command would cause the problem. Once I put them all in their own cells it now works:

New-Item -ItemType Directory -Path "C:\Users\Administrator\Documents\WindowsPowershell" Set-Location C:\Users\Administrator\Documents\WindowsPowershell New-Item -ItemType file -force $profile

If I run them all on one line separated by semi-colons it also works. It also runs fine if I put it in a PS1 script. Only when the 3 lines are in one cell does the "caching" happen and you have to run following cells twice to get the correct result.


Original: This may be related. I've run into this on Windows 10 (native), Server 2016 & 2019 (VMware WS 15), Firefox 68.0.1 (and Chrome and Brave). Runnng with Powershell kernel 0.0.7

In FF I've turned off all caching (devtools.cache.disabled = true; browser.cache.disk.enable = false; browser.cache.memory.enable = false)

When I hit a code cell with output that is long it seems to cache it and when I click the next code cell it outputs the previous cell's output. When I click the cell and run it a second time the output is then correct. Enabling cell scrolling did not fix it.

This behavior also occurs in the console but not the terminal.

When I look at the notebook file in Notepad++ it shows all the lines with "LF" not the "CR LF" I was expecting in windows but even changing that to "CR LF" did not fix the issue.

If you want the notebook for testing let me know.

(base) C:\Anaconda3>jupyter --version jupyter core : 4.5.0 jupyter-notebook : 6.0.0 qtconsole : 4.5.1 ipython : 7.6.1 ipykernel : 5.1.1 jupyter client : 5.3.1 jupyter lab : 1.0.2 nbconvert : 5.5.0 ipywidgets : 7.5.0 nbformat : 4.4.0 traitlets : 4.3.2

krassowski commented 2 years ago

This issue should not get locked, as we have an explicit dialog telling users to paste their debug reports here:

https://github.com/jupyterlab/jupyterlab/blob/a2d2c5b26f16b97e605b43e47cfb9a301620921d/packages/codemirror/src/editor.ts#L1138-L1146

with most recent report today in #10770

krassowski commented 2 years ago

I got this error today in JupyterLab version 3.1.4 with the following traceback, which I think might have been triggered by ctrl + z after I noticed that I lost one of my cells with important output (I figured I must have deleted it accidentally but it might have been a bug instead):

Uncaught (in promise) TypeError: Cannot read property 'oldValue' of undefined
    at Array._modelObserver (jlab_core.86360d749a1ef5f29afb.js?v=86360d749a1ef5f29afb:2)
    at Object.a (1231.fcdcebbdb2f6c490f0ea.js?v=fcdcebbdb2f6c490f0ea:1)
    at Ge (9795.3491c2c7bd9eb56acd87.js?v=3491c2c7bd9eb56acd87:1)
    at Array.<anonymous> (9795.3491c2c7bd9eb56acd87.js?v=3491c2c7bd9eb56acd87:1)
    at a (1231.fcdcebbdb2f6c490f0ea.js?v=fcdcebbdb2f6c490f0ea:1)
    at qn (9795.3491c2c7bd9eb56acd87.js?v=3491c2c7bd9eb56acd87:1)
    at Kn (9795.3491c2c7bd9eb56acd87.js?v=3491c2c7bd9eb56acd87:1)
    at Zn (9795.3491c2c7bd9eb56acd87.js?v=3491c2c7bd9eb56acd87:1)
    at Qn.undo (9795.3491c2c7bd9eb56acd87.js?v=3491c2c7bd9eb56acd87:1)
    at undo (jlab_core.86360d749a1ef5f29afb.js?v=86360d749a1ef5f29afb:2)

and following (redacted) log at first occurrence

{
    "model":"reports['REDACTEDREDACTEDRED'].reports['ordinal'].average_ranking.overall.frame()",
    "view":"reports['REDACTEDREDACTEDRED'].reports['ordinal'].average_ranking.overall",
    "selections":[
        {
            "uuid":"544e67fd-ef62-4068-8c0d-5d5d01f8b9a5",
            "start":{"line":0,"column":0},
            "end":{"line":0,"column":0},
            "style":{"className":"","displayName":"","color":"black"}
        }
    ],
    "cursor":{"line":0,"column":0},
    "lineSep":null,
    "mode":"text/x-ipython",
    "change":{
        "from":{"line":0,"ch":73,"sticky":null},
        "to":{"line":0,"ch":79,"sticky":null},
        "text":[""],
        "origin":"prosemirror-binding",
        "removed":[".frame"]
    }
}

this repeated a few times after (I do not remember exact sequence of events), with one of the recent states being:

{
    "model":"reports['REDACTEDREDACTEDRED'])",
    "view":"reports['REDACTEDREDACTEDRED']",
    "selections":[
        {
            "uuid":"544e67fd-ef62-4068-8c0d-5d5d01f8b9a5",
            "start":{"line":0,"column":0},
            "end":{"line":0,"column":0},
            "style":{"className":"","displayName":"","color":"black"}
        }
    ],
    "cursor":{"line":0,"column":0},
    "lineSep":null,
    "mode":"text/x-ipython",
    "change":
    {
        "from":{"line":0,"ch":30,"sticky":null},
        "to":{"line":0,"ch":103,"sticky":null},
        "text":[""],
        "origin":"prosemirror-binding",
        "removed":["reports['REDACTEDREDACTEDRED'].reports['REDACTE'].average_ranking.overall"]
    }
}
_checkSync @ jlab_core.86360d749a1ef5f29afb.js?v=86360d749a1ef5f29afb:2

which manifests like:

Screenshot from 2021-08-09 15-32-44

I hope that #10756 will fix this, but let's see nope, that fix is already in since 3.1.2, so that did not fix it. It could be also relevant to discussion in #10694.

krassowski commented 2 years ago

CC @hbcarlos and @dmonad on the above issue which seems to be a new addition to the repertoire; the traceback is coming from on of the non-null assertion operators in:

https://github.com/jupyterlab/jupyterlab/blob/21b3fdf053701368569736bce7661ad3925236fb/packages/shared-models/src/ymodels.ts#L553-L570

this is just FYI for now, I am not yet confident if the shared models are the culprit or just a first place that gets kicked after an actual error, but in any case it might be worth considering if we should use .? there.

relaxxpls commented 2 years ago
{
    "model": "X = np.array([0, 0.1, 0.2, 0.4, 0.6, 0.7, 0.8])\r\nF = 0.2\r\nrA = -1 * np.array([0.45, 0.37, 0.3, 0.195, 0.113, 0.079, 0.05])\r\ny = -F / rA\r\n\r\nplt.plotkX, ykk, 'o-')\r\nx = X[0:6]\r\ny = y[0:6]\r\nplt.fill_between(x, 0, y)\r\n\r\narea = np.trapz(y, x=x)\r\nprint(\"Area under curve:\", area)",
    "view": "X = np.array([0, 0.1, 0.2, 0.4, 0.6, 0.7, 0.8])\nF = 0.2\nrA = -1 * np.array([0.45, 0.37, 0.3, 0.195, 0.113, 0.079, 0.05])\ny = -F / rA\n\nplt.plot(X, yk, 'o-k')\nx = X[0:6]\ny = y[0:6]\nplt.fill_between(x, 0, y)\n\narea = np.trapz(y, x=x)\nprint(\"Area under curve:\", area)",
    "selections": [
        {
            "uuid": "abfc3074-9ab0-4e3d-916a-daae31d20ac2",
            "start": {
                "line": 5,
                "column": 18
            },
            "end": {
                "line": 5,
                "column": 18
            },
            "style": {
                "className": "",
                "displayName": "",
                "color": "black"
            }
        }
    ],
    "cursor": {
        "line": 5,
        "column": 18
    },
    "lineSep": null,
    "mode": "text/x-ipython",
    "change": {
        "from": {
            "line": 5,
            "ch": 13,
            "sticky": "before",
            "xRel": -1.75
        },
        "to": {
            "line": 5,
            "ch": 13,
            "sticky": "before",
            "xRel": -1.75
        },
        "text": [
            "k"
        ],
        "origin": "+input",
        "removed": [
            ""
        ]
    }
}
mmarich1 commented 2 years ago

Just got these errors

vendors~main.d6ae31c7fff1f92f0bb6.js:2 Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951 _checkSync @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 vendors~main.d6ae31c7fff1f92f0bb6.js:2 {"model":"## New compact query adjusted with dynanic date range\r\n\r\nsql_query = \"\"\"\r\nSELECT \r\nproduct_id\r\nFROM shopify.pro\t\t\t\t \r\nORDER by 1\r\n;\"\"\"\r\ndf = pd.DataFrame(a_fetchall_function(sql_query), columns = ['product_id'])\r\ndf.head()","view":"## New compact query adjusted with dynanic date range\n\nsql_query = \"\"\"\nSELECT \nproduct_id\nFROM shopify.products\nORDER by 1\n;\"\"\"\ndf = pd.DataFrame(a_fetchall_function(sql_query), columns = ['product_id'])\ndf.head()","selections":[{"uuid":"40efec92-068d-4403-9b72-da8d6cde8d63","start":{"line":5,"column":21},"end":{"line":5,"column":21},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":5,"column":21},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":5,"ch":21,"sticky":"after","xRel":10.0511474609375},"to":{"line":5,"ch":27,"sticky":"before","xRel":10.0682373046875},"text":[""],"removed":["\t\t\t\t\t "]}} _checkSync @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 vendors~main.d6ae31c7fff1f92f0bb6.js:2 Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951 _checkSync @ vendors~main.d6ae31c7fff1f92f0bb6.js:2

vendors~main.d6ae31c7fff1f92f0bb6.js:2 {"model":"## New compact query adjusted with dynanic date range\r\n\r\nsql_query = \"\"\"\r\nSELECT \r\nproduct_id\r\nFROM shopify.pr\t\t\t\t \r\nORDER by 1\r\n;\"\"\"\r\ndf = pd.DataFrame(a_fetchall_function(sql_query), columns = ['product_id'])\r\ndf.head()","view":"## New compact query adjusted with dynanic date range\n\nsql_query = \"\"\"\nSELECT \nproduct_id\nFROM shopify.product\nORDER by 1\n;\"\"\"\ndf = pd.DataFrame(a_fetchall_function(sql_query), columns = ['product_id'])\ndf.head()","selections":[{"uuid":"40efec92-068d-4403-9b72-da8d6cde8d63","start":{"line":5,"column":20},"end":{"line":5,"column":20},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":5,"column":20},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":5,"ch":20,"sticky":"after"},"to":{"line":5,"ch":21,"sticky":"before","xRel":184.0511474609375},"text":[""],"removed":["s"]}} _checkSync @ vendors~main.d6ae31c7fff1f92f0bb6.js:2

vendors~main.d6ae31c7fff1f92f0bb6.js:2 Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951 _checkSync @ vendors~main.d6ae31c7fff1f92f0bb6.js:2

vendors~main.d6ae31c7fff1f92f0bb6.js:2 {"model":"## New compact query adjusted with dynanic date range\r\n\r\nsql_query = \"\"\"\r\nSELECT \r\nproduct_id\r\nFROM shopify.p\t\t\t\t \r\nORDER by 1\r\n;\"\"\"\r\ndf = pd.DataFrame(a_fetchall_function(sql_query), columns = ['product_id'])\r\ndf.head()","view":"## New compact query adjusted with dynanic date range\n\nsql_query = \"\"\"\nSELECT \nproduct_id\nFROM shopify.produc\nORDER by 1\n;\"\"\"\ndf = pd.DataFrame(a_fetchall_function(sql_query), columns = ['product_id'])\ndf.head()","selections":[{"uuid":"40efec92-068d-4403-9b72-da8d6cde8d63","start":{"line":5,"column":19},"end":{"line":5,"column":19},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":5,"column":19},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":5,"ch":19,"sticky":"after"},"to":{"line":5,"ch":20,"sticky":"before","xRel":59.196044921875},"text":[""],"removed":["t"]}} _checkSync @ vendors~main.d6ae31c7fff1f92f0bb6.js:2

vendors~main.d6ae31c7fff1f92f0bb6.js:2 Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951 _checkSync @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 factory @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 setTimeout (async) (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 a @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 Promise.then (async) l @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 (anonymous) @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 c @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e.schedule @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 e._execute @ vendors~main.d6ae31c7fff1f92f0bb6.js:2 s @ vendors~main.d6ae31c7fff1f92f0bb6.js:2

vendors~main.d6ae31c7fff1f92f0bb6.js:2 {"model":"## New compact query adjusted with dynanic date range\r\n\r\nsql_query = \"\"\"\r\nSELECT \r\nproduct_id\r\nFROM shopify.pt\t\t\t\t \r\nORDER by 1\r\n;\"\"\"\r\ndf = pd.DataFrame(a_fetchall_function(sql_query), columns = ['product_id'])\r\ndf.head()","view":"## New compact query adjusted with dynanic date range\n\nsql_query = \"\"\"\nSELECT \nproduct_id\nFROM shopify.product\nORDER by 1\n;\"\"\"\ndf = pd.DataFrame(a_fetchall_function(sql_query), columns = ['product_id'])\ndf.head()","selections":[{"uuid":"40efec92-068d-4403-9b72-da8d6cde8d63","start":{"line":5,"column":20},"end":{"line":5,"column":20},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":5,"column":20},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":5,"ch":19,"sticky":"before","xRel":145.36083984375},"to":{"line":5,"ch":19,"sticky":"before","xRel":145.36083984375},"text":["t"],"origin":"+input","removed":[""]}}

sanbales commented 2 years ago
{"model":"\r\n]","view":"","selections":[{"uuid":"beaa9d36-1069-4bc7-894c-fa8a32385795","start":{"line":0,"column":0},"end":{"line":0,"column":0},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":0},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":0,"ch":0,"sticky":null},"to":{"line":3,"ch":1,"sticky":null},"text":[""],"origin":"prosemirror-binding","removed":["[","     [id_to_parts_name_lookup[sq[0]], id_to_parts_name_lookup[sq[1]]]","     for sq in value_binding_sequenceses","]"]}}
ChavezCheong commented 2 years ago

{"model":"### Problem 1.1\r\n$ g = \nabla V(x) \newline = \begin{bmatrix} (1+k)x_0 - kx_1 \\ (1+k)x_1 - kx_0 \end{bmatrix} $\n\n$ H(x) = \begin{bmatrix} k+1 & -k \\ -k & k+1 \end{bmatrix} $x} $","view":"### Problem 1.1\n\n$ g = \nabla V(x) \newline = \begin{bmatrix} (1+k)x_0 - kx_1 \\ (1+k)x_1 - kx_0 \end{bmatrix} $\n\n$ H(x) = \begin{bmatrix} k+1 & -k \\ -k & k+1 \end{bmatrix} $","selections":[{"uuid":"d26e641f-42b4-4198-bd14-c08dd83529fc","start":{"line":0,"column":15},"end":{"line":0,"column":15},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":15},"lineSep":null,"mode":"text/x-ipythongfm","change":{"from":{"line":2,"ch":0,"sticky":"after","xRel":-4},"to":{"line":4,"ch":61,"sticky":"before","xRel":19.850006103515625},"text":["$ g = \nabla V(x) \newline = \begin{bmatrix} (1+k)x_0 - kx_1 \\ (1+k)x_1 - kx_0 \end{bmatrix} $","","$ H(x) = \begin{bmatrix} k+1 & -k \\ -k & k+1 \end{bmatrix} $"],"origin":"+input","removed":["$ g = \nabla V(x) \newline = \begin{bmatrix} (1+k)x_0 - kx_1 \\ (1+k)x_1 - kx_0 \end{bmatrix} $","","$ H(x) = \begin{bmatrix} k+1 & -k \\ -k & k+1 \end{bmatrix} $"]}}

Sti2nd commented 2 years ago

"Code Editor out of Sync" kept popping up on me on each save.

image

{"model":"with open(\"./.json\", encoding=\"utf-8\") as f:\r\n data = json.load(f)","view":"with open(\"./.json\", encoding=\"utf-8\") as f:\n data = json.load(f)","selections":[{"uuid":"192d1578-4b22-47b8-8d3e-252624862291","start":{"line":0,"column":13},"end":{"line":0,"column":13},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":0,"column":13},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":0,"ch":13,"sticky":"after","xRel":3.105133056640625},"to":{"line":0,"ch":14,"sticky":"before"},"text":[""],"origin":"+delete","removed":["3"]}}

thethereza commented 2 years ago

I wrote some jupyter notebooks code in VS code and copied it to a unix server -- and got this message all the time. After some experimentation, it seemed that the literal "\r" (carriage returns) in the code was the culprit.

in.ipynb | sed 's/\\r//g' > out.ipynb

fixed the issue I was having. I see that "\r" appears in a number of comments above and that it was suggested that it was the culprit. I suggest changing the error message on jupyter from

Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951

to

Please remove all instances of \r in your code.

Or something like that. Or just fix the bug?

mrtkp9993 commented 2 years ago

Code editor out of sync error:

{"model":"# fixing data\r\n# Fix bist30 data\r\n# 2020-07\r\nbist30.loc[:\"2020-07\"] = bist30.loc[:\"2020-07\"] / 100\r\n\r\n# Fix bist30 missing data\r\nbist30 = bist30.reindex(kozaa.index.values, meffilld=\"pad\")","view":"# fixing data\n# Fix bist30 data\n# 2020-07\nbist30.loc[:\"2020-07\"] = bist30.loc[:\"2020-07\"] / 100\n\n# Fix bist30 missing data\nbist30 = bist30.reindex(kozaa.index.values, method=\"ffill\")","selections":[{"uuid":"eeeb6441-d0d6-4cff-a6da-5f262080d085","start":{"line":6,"column":57},"end":{"line":6,"column":57},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":6,"column":57},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":6,"ch":52,"sticky":null},"to":{"line":6,"ch":55,"sticky":null},"text":["ffill"],"origin":"paste","removed":["pad"]}}
thethereza commented 2 years ago

Code editor out of sync error:

{"model":"# fixing data\r\n# Fix bist30 data\r\n# 2020-07\r\nbist30.loc[:\"2020-07\"] = bist30.loc[:\"2020-07\"] / 100\r\n\r\n# Fix bist30 missing data\r\nbist30 = bist30.reindex(kozaa.index.values, meffilld=\"pad\")","view":"# fixing data\n# Fix bist30 data\n# 2020-07\nbist30.loc[:\"2020-07\"] = bist30.loc[:\"2020-07\"] / 100\n\n# Fix bist30 missing data\nbist30 = bist30.reindex(kozaa.index.values, method=\"ffill\")","selections":[{"uuid":"eeeb6441-d0d6-4cff-a6da-5f262080d085","start":{"line":6,"column":57},"end":{"line":6,"column":57},"style":{"className":"","displayName":"","color":"black"}}],"cursor":{"line":6,"column":57},"lineSep":null,"mode":"text/x-ipython","change":{"from":{"line":6,"ch":52,"sticky":null},"to":{"line":6,"ch":55,"sticky":null},"text":["ffill"],"origin":"paste","removed":["pad"]}}

Look at the last comment