problems in writing to a file

asked 2015-01-29 12:17:43 -0500

Hi All, I am using rospython to create a node..

I wanted to write an image file in the current working directory.

In my node in the begining I mentioned the path of the current working directory

path_to_write = str('~/current working directory path')

before writing to the file I use current_path = os.path.dirname(os.path.abspath(__file__)) rospy.loginfo(current_path)

and then I write the image file as

if current_path in path_to_write: print("I am Here") cv2.imwrite('file_name.png') else: pass

But when I run this using roslaunch I am able to get 1. my current_path which is same as the path_to_write 2. I am here

but when I go to my current directory, I find the file is not written. can any body help me out in this issue.?

I have all my imports here

import os import rospy import sys import numpy as np import cv2 from cv_bridge import CvBridge

edit retag flag offensive close merge delete