Closed seivazi closed 4 years ago
Sorry I didn't share, I have this:
diff --git a/mvp_grasping/src/mvp_grasping/panda_base_grasping_controller.py b/mvp_grasping/src/mvp_grasping/panda_base_grasping_controller.py
index 0aa091e..b017a23 100644
--- a/mvp_grasping/src/mvp_grasping/panda_base_grasping_controller.py
+++ b/mvp_grasping/src/mvp_grasping/panda_base_grasping_controller.py
@@ -28,6 +28,10 @@ class Logger:
def __init__(self, output_desc='run', output_dir='~'):
dt = datetime.datetime.now().strftime('%m%d_%H%M%S')
self.out_file = os.path.join(output_dir, '%s_%s.txt' % (dt, output_desc))
+
+ dirname = os.path.dirname(self.out_file)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
def write_line(self, l):
with open(self.out_file, 'a') as f:
Running rosrun mvp_grasping panda_mvp_grasp.py throw an error: catkin_ws/src/mvp_grasp/mvp_grasping/src/mvp_grasping/panda_base_grasping_controller.py", line 33, in write_line with open(self.out_file, 'a') as f: IOError: [Errno 2] No such file or directory: '~/0205152707.txt'
I fixed it by giving a fixed file name but you may change it differently.