File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 2727 When initialized, it will be passed an instance of this object.
2828"""
2929
30- import imp
30+ from importlib . machinery import SourceFileLoader
3131import inspect
3232import logging
3333import pathlib
34+ import types
3435import typing
3536
3637import wpilib
@@ -103,7 +104,9 @@ def _create_and_attach(
103104 if physics_module_path .exists ():
104105 # Load the user's physics module if it exists
105106 try :
106- physics_module = imp .load_source ("physics" , str (physics_module_path ))
107+ loader = SourceFileLoader ("physics" , str (physics_module_path ))
108+ physics_module = types .ModuleType (loader .name )
109+ loader .exec_module (physics_module )
107110 except :
108111 logger .exception ("Error loading user physics module" )
109112 raise PhysicsInitException ()
You can’t perform that action at this time.
0 commit comments