question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unexpected token 'open'

See original GitHub issue

Issue Type: Bug

with open("test.html", 'w', encoding='utf-8') as f:
    f.write(page.text)

unexpected token ‘open’

Extension version: 2018.7.0 VS Code version: Code 1.25.1 (1dfc5e557209371715f655691b1235b6b26a06be, 2018-07-11T15:43:53.668Z) OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel® Core™ i5-5200U CPU @ 2.20GHz (4 x 2195)
GPU Status 2d_canvas: unavailable_software
flash_3d: unavailable_software
flash_stage3d: unavailable_software
flash_stage3d_baseline: unavailable_software
gpu_compositing: unavailable_software
multiple_raster_threads: unavailable_off
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: unavailable_software
video_encode: unavailable_software
vpx_decode: unavailable_software
webgl: unavailable_off
webgl2: unavailable_off
Memory (System) 7.92GB (4.18GB free)
Process Argv D:\Microsoft VS Code\Code.exe F:\文档\GitHub\Protein
Screen Reader no
VM 67%

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MikhailArkhipovcommented, Aug 21, 2018

Most probably was caused by threading issue where text buffer was going out of sync with between LS and VS Code. Fixed by https://github.com/Microsoft/PTVS/pull/4645

1reaction
JohnRomanskicommented, Aug 21, 2018

I am running Python 3.7.0

After deleting the languageServer directory, I loaded up the folder again. VSCode reported that it was downloading the Microsoft Python Language Server again.

After it re downloaded the new language server, I no longer have issues. I checked this with the two examples I discussed above as well as a blank Python file. Could it be that the language server just needed updating or something?

I did the same thing, and notice the server was downloaded again, and no longer received this error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

unexpected token 'open' · Issue #2210 · microsoft/vscode-python
I'm getting the issue as well. I believe I'm using the new language server, but don't have a way to check. I'm also...
Read more >
How to solve unexpected token parser 16 visual studio code
There are 3 things that could be. The first is simple, restart your editor and see if the issue persists. The second thing...
Read more >
SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
python unexpected token bug, in visual studio 2019
When you input Non-English characters, it will prompt “unexpected token”. Check your input method, use English input method to enter characters.
Read more >
Unexpected Token Error in VS Code
I'm trying to set up VS Code for ObjectScript using the instructions found here. I've got both Cache 2018.1.2.309.0 and IRIS 2020.1.0.215.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found