Search code examples
pythonpepper

Pepper: accesing project folder via ssh


I have accessed to Pepper robot via ssh. My intention is to find the project folder to see where files are created when the robot create a file via

file = open('test.txt', 'w')
file.write('testing how to save project data')
file.close()

the problem is that I don't know where is saved the project, anyone knows in which path is?


Solution

  • For a pure .py script, add this to your script and you will find the directory:

    import os
    strPath = os.path.dirname(__file__)
    print strPath
    

    If your project is installed with Choregraphe, the general directory is /var/persistent/home/nao/.local/share/PackageManager/apps So assuming your .py file is located in the root directory of your project, test.txt will be located in /var/persistent/home/nao/.local/share/PackageManager/apps/<project_name>/test.txt

    Edit:

    For code inside Choregraphe the solution looks differently.

    self.behaviorPath = ALFrameManager.getBehaviorPath(self.behaviorId)
    self.logger.info(self.behaviorPath)