Possible bug? SystemError: unknown opcode


Running the debugger on this section of code:

for int in int_list:
command_list = [] # clear the command list for each interface
sh_run_int = ssh_conn.send_command('sh run int {0}'.format(int)) # get the int config
int_configs[int] = sh_run_int # add the int and config to the dictionary
if 'ip flow ingress' in sh_run_int:
sh_run_int = '''Building configuration...

Current configuration : 330 bytes
interface GigabitEthernet0/0
description TEST-ES-01 G1/0/1
no ip address
ip directed-broadcast
ip nbar protocol-discovery
ip flow monitor NTA-MONITOR input
ip flow monitor LIVEACTION-FLOWMONITOR input
ip flow monitor LIVEACTION-FLOWMONITOR output
load-interval 30
duplex full
speed 1000
no snmp trap link-status

I get "SystemError: unknown opcode". Launching a Python console and running this code doesn't produce any errors. 

I'm running:
Python 3.6.1
PyCharm 2017.1.1
Build #PY-171.4163.6, built on April 11, 2017
JRE: 1.8.0_121-b13 x86
JVM: Java HotSpot(TM) Client VM by Oracle Corporation
Windows 7 6.1

Official comment

Hello guys! Thank you for the feedback! But I'm still can't reproduce the problem locally. I've created a bug repoprt in our issue tracker: https://youtrack.jetbrains.com/issue/PY-24022
Feel free to leave comments there.

Emanon299 Could you please provide a sample project for reproducing the bug?
Also could you please test your programs with PyCharm 2017.1.2 update which was released today: https://blog.jetbrains.com/pycharm/2017/04/pycharm-2017-1-2-out-now/

The error is on this line:

if 'ip flow ingress' in sh_run_int:


Hi Warren! Yes, it looks like a bug. Could you please provide a whole code snippet for reproducing it? Unfortunately, I can't reproduce the bug with this fragment.

As a temporary workaround please set environment variable PYDEVD_USE_FRAME_EVAL=NO in your Run configuration.


I am getting (probably) the same error on Mac OS X. Sadly, it seems to be quite hard to provide a minimum working example. It seems to happen on "convoluted" code, but I don't really know what specifically.

I am using Python 3.6.1 from python.org, the python speedup extensions were (probably) compiled using the clang compiler from xCode.

For me the first breakpoint went fine, but after clicking continue the second breakpoint was never hit, giving me the SystemError instead.

I have not used the debugger speedups before, so I can not say wether the culprit is Pycharm 2017.1 or Python 3.6.1.


Hello, I'm also experiencing problems with this.

It only seems to trigger when running the unit tests through PyCharm in Debug mode.

I'm unable to produce any code which can separately reproduce the issue, but here's a link to the function causing the problem:


The error triggers at line 243 when debugging test cases (not always), but runs without error if I'm running the test suite from the CLI.


i'm on mac sierra with python 3.6.0, pycharm 2017.1.1 (haven't attempted to reproduce on 2017.1.2 yet).  workaround worked for me.  I have similar input as original poster where I'm parsing network device config.  I don't remember seeing this issue prior to 2017.1 though and I run debug quite often.  Same as others, only see it during debug, never during normal runs.


EDIT:  btw, the debug break points work as expected until it reads in the first config line.  then it throws this error.


Similar situtation. I am on windows 10 15063.138 with python 3.6.0, pycharm 2017.1.1. When I run debugger, it reports

Connected to pydev debugger (build 171.4163.6)
XXX lineno: 181, opcode: 0
Traceback (most recent call last):
File "D:\PyCharm\PyCharm Community Edition 2017.1.1\helpers\pydev\pydevd.py", line 1578, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\PyCharm\PyCharm Community Edition 2017.1.1\helpers\pydev\pydevd.py", line 1015, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\PyCharm\PyCharm Community Edition 2017.1.1\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/PycharmProjects/SnakeAI/testSnake.py", line 181, in <module>
SystemError: unknown opcode

In addition, the debugger sometimes cannot pause in the break points.


I'm using Python 3.6.1 (with `conda` virtual environment), PyCharm 2017.1.1 on Ubuntu 16 and having the same problem. Settting environment variable PYDEVD_USE_FRAME_EVAL=NO in my RUN configuration does help.


I get the System Error: unknown opcode reliably when a break point is hit in a specific part of my code.   The PYDEVD_USE_FRAME_EVAL=NO work around does _not_ work for me.   Are there other solutions or work arounds that I can try?

My setup:

PyCharm Community Edition 2017.1.2
Build #PC-171.4249.47, built on April 26, 2017
JRE: 1.8.0_112-release-736-b21 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.4





For me. After moving to 2017.1.2. I cannot reproduce anymore. Will update again though if i see it again.


Jeffmcglaun Which version of Python interpreter do you use? Do you use Cython speed ups in debugger (do you see warning about them when you run debugger)? You can try also to set environment variable PYDEVD_USE_CYTHON=NO. Does it help?


Thanks for the reply Elizabeth.

Python 3.6.1

I do use Cython speed ups.

The PYDEVD_USE_CYTHON=NO addition didn't help.....




Jeffmcglaun Could you please provide a code sample (or maybe a simplified version of your code) for reproducing the bug?


Just got it again.  I am on 2017.1.2 with 3.6.0 still.  I didn't get it until I ran the command for debug speedups.  After that I started to get it.  Adding the PYDEVD_USE_FRAME_EVAL=NO caused the debugger to work again. 


I also have this problem. I was debugging with all going smoothly, and then suddenly I started getting the error on the if-statement of this block:

self.model_dir = os.path.join(model_dir, self.name)
if not os.path.isdir(self.model_dir):

I added the PYDEVD_USE_FRAME_EVAL=NO to my Run Config, and I don't get the error.


Marc Grosz Hi! Unfortunately, we can't investigate the problem until we have a separate piece of code where this bug is reproducible.

Mdifranc Could you please say the values of variables in this example? Could you please provide a separate Python file where the bug is reproducible?


Elizabeth, it will take me a few days to get a smaller subset of code that breaks as an example.   In the mean time, I moved to another development environment that does not have the issue with the same code.  

That setup is:

Python 3.5.1

There is no Cython speedup.

PyCharm Community Edition 2017.1.2
Build #PC-171.4249.47, built on April 26, 2017
JRE: 1.8.0_112-release-736-b21 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.4

The two differences in this environment vs. the broken one that I spot right off is Python 3.5.1 vs 3.6 and Cython not installed.

One question, how to I determine if I've set the environment variables correctly and that they are in effect?   Seems like almost everyone else using the PYDEVD_USE_FRAME_EVAL=NO work around is not having the problem, but me.   Wonder if I have implemented the environment variable incorrectly.   

Also, as a test, how do I uninstall Cython from my broken environment vs. setting PYDEVD_USE_CYTHON=NO?   

Until I can strip down my code to run in your environment, seems I've having debug issues in multiple nested if/elif statements.   This looks like a common thread in the other examples given.

I'll revert soon with a working example of the problem.











Elizabeth.  Sadly I can't give any code.  I work in a strict environment.  The basic gist is the following though

if var1 is not dict1[key1]['someval1']

var1 = 4

key1 = an acl name

dict1[key1]['someval1'] = 6

how do I delete the speedups?  i'm pretty sure that is when it started.


Jeffmcglaun Marc Grosz

Thank you for the feedback! We're still trying to reproduce the bug.

You can set environment variables right in Run configuration (Run | Edit configurations | Environment variables). In order to check if the variable is defined in the program, you can add these lines to your script:

import os


In order to delete Cython speedups, you should go to the folder <PyCharm folder>/helpers/pydev. There you should delete all the shared libraries (files with extension *.so) in the folders `_pydevd_bundle` and `_pydevd_frame_eval` (important: not _pydev_bundle, but _pydevd_bundle). If you use Windows, you should delete all the files with extension *.pyd in this same folders.


Ok....I put my environment variables in the General References (Preferences -> Console -> Python Console), which doesn't set the variables in the right spot.   I'll have to redo my testing and get back to you with more accurate results on whether PYDEVD_USE_FRAME_EVAL is a work around for me.

Sorry for the confusion.  Led myself down the wrong path in the online documentation.



I'm also getting this error. I happen to have some code I am able to freely share. Let me know if you'd like it to review and solve this bug.



Chaseschuette Yes, could you please provide a code sample for reproducing?


Just ran the debugger on my code (which I've been continually adding to) and I'm no longer able to reproduce the error. Wish I had saved the version I had when it was producing the bug. If I'm able to reproduce it I'll post for you.


I ran into the same issue.

My setup:

PyCharm 2017.1.2
Build #PY-171.4249.47, built on April 26, 2017
JRE: 1.8.0_112-release-736-b21 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 2.6.32-642.4.2.el6.x86_64
Python 3.6.1
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
With debug speedups installed.
keras 2.0.2 from anaconda

It says "XXX lineno: 1841, opcode: 0" on this line.

It happens each time I try to run this my test with "debug" config. Same test works OK with "run" config. Debug with PYDEVD_USE_FRAME_EVAL=NO works OK as well (thanks for the hint!).

However, I can get through this line, by clicking "Step Into" until I'm out. Next, with "step over" I'm able to get to line 1878. On this line, it would fail just like in the first case if I press "step over" once again. Which is quite strange, cause "outs" variable itself looks OK, and the following works OK in the debugger console:

>>> outs
[array(3.9574601650238037, dtype=float32), array(0.16819103062152863, dtype=float32)]

>>> isinstance(outs, list)

>>> outs[1]
array(0.16819103062152863, dtype=float32)

>>> outs[0]
array(3.9574601650238037, dtype=float32)

The fix "PYDEVD_USE_FRAME_EVAL=NO" works for me. 


I'm also affected (debug only). If I break the debugging a few lines later, the debugger works.


PYDEVD_USE_FRAME_EVAL hack works for me. Guys why should I pay when the debug is always breaking? Virtually any script that I write ends with this error during debug.


The fix provided also works for me. Any updates on when the bug will be fixed?


Msancheznet Unfortunately we still can't reproduce it.


Please sign in to leave a comment.