Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

env: python\r: No such file or directory error : even though there is no /r/n in the script

I am working on Ubuntu 20.04 on Raspberry Pi

I read this error is caused by Windows – Unix Formats conflicts
But my script has no /r/n in it, how can I solve this?

#!/usr/bin/env python

import rospy
from laser_assembler.srv import *
from sensor_msgs.msg import PointCloud2

rospy.init_node("test_client") 
rospy.wait_for_service("assemble_scans2")
assemble_scans = rospy.ServiceProxy('assemble_scans2',AssembleScans2)
pub = rospy.Publisher("/pointcloud", PointCloud2, queue_size = 1)
r = rospy.Rate(1)

while not rospy.is_shutdown():
    try:
        resp = assemble_scans(rospy.Time(0,0), rospy.get_rostime())
        print "Got cloud with %u points" % len(resp.cloud.data)
        pub.publish(resp.cloud)

    except rospy.ServiceException, e:
        print "Service call failed: %s" %e
        
    r.sleep()

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Windows by default uses CRLF line endings while Linux/Unix use LF line endings.
If your application uses both windows and linux, its better to keep your code in LF since both platforms understand LF line endings.

A foolproof way to convert your code to unix compatible line endings is to use Vi/Vim and explicitly set the line endings to LF.

Use this command in Vi – :set ff=unix to set the line endings to LF. Your code should then work.

And to avoid further conflicts, while developing on Windows, make sure to check that your text editor line ending settings is set to LF.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading