RobotPy Sim -- Windows fatal exception: access violation

We are running our code in 2020 sim and receiving fatal exception error. The sim dies when it runs a command group and says:

Windows fatal exception: access violation

We are speculating it could be due to a change in the 2020 command package. We used requires(Subsystem) and are wondering if this could be the cause of it failing.

Any suggestions would be greatly appreciated!

Could you share your code?

See also - something will probably be relevant there.

The error in the console of the robot when trying to upload the code is
File ‘path to the file on the rio/commands/’, line 13 in init

Line 13 in do_winch reads

I have a feeling the way to use self.requires has changed since the super().init() is not used for 2020 wpilib commands but I don’t know how to use it correctly anymore

also we have checked the 2020 release notes and haven’t found anything, but maybe there’s something we missed

Yeah, you’re missing __init__ calls to the superclass for all your Subsystems and Commands.

Right, but here’s an example from the 2020 update notes

from wpilib.command import Command

class GoodCommand(Command):

# no custom __init__, nothing extra required

def foo(self):

Yes, that example does not define its own __init__, so the superclass __init__ does get called.

where does it get called in that example? Or should I just add this


If you override __init__ (i.e. you define it in your subclass), then you need to call Command.__init__(self) etc. in your __init__.


Okay I will try that thanks

We tried to put Command.init(self) in commands and tried to put super().init_() in subsystems which didn’t work in the sim. So, we removed superinit from subsystems but this still didn’t run in the sim.

We’re getting an error that says
init(): incompatible constructor arguments

The rule of thumb is that you call the base class constructor directly. So if you have:

class Foo(Bar):

Then calling it’s constructor in your custom __init__ is going to be

class Foo(Bar):
    def __init__(self):

So a subsystem would call Subsystem.__init__, etc.

1 Like

Also, I fixed some issues in your repo, and made a pull request.

1 Like

Where can we find the arguments for the command group init? Also thanks for the pull

This year’s command API documentation is at

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.