cortictechnology / cep

CEP is a software platform designed for users that want to learn or rapidly prototype using standard A.I. components.
MIT License
166 stars 21 forks source link

Error while deleting directory tuned_blazeface_lib #20

Closed acommuni closed 2 years ago

acommuni commented 2 years ago

There is an error in syslog file :

Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m Associating oakd pipeline to: oakd_hand_asl
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m Traceback (most recent call last):
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/modules/vision/main.py", line 17, in <module>
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     vision_main = VisionMain()
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/modules/vision/main.py", line 13, in __init__
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     super().__init__(VisionModule(), port=9436)
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/modules/vision_module.py", line 14, in __init__
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     super().__init__("vision")
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/base_module.py", line 49, in __init__
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     self.create_factory()
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/modules/vision_module.py", line 18, in create_factory
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     self.worker_factory = VisionFactory()
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/modules/vision/vision_factory.py", line 12, in __init__
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     super().__init__("vision")
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/base_factory.py", line 23, in __init__
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     self.load_configuration_file()
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/base_factory.py", line 54, in load_configuration_file
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     mod_class = getattr(mod, module_config[module])()
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/modules/vision/face_detection.py", line 23, in __init__
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     super().__init__("cpu",
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m   File "/data/curt/modules/vision/tvm_processing.py", line 60, in __init__
Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m     os.rmdir(os.path.dirname(os.path.realpath(__file__))

Feb  9 20:22:16 raspberrypi bash[475]: #033[35;1mcurt_vision_1         |#033[0m OSError: [Errno 39] Directory not empty: '/data/curt/modules/vision/../../../models/modules/vision/platforms/rpi32/tuned_blazeface_lib'

The code tries to delete an non empty dir. The fix consists in using shutil.rmtree (see attached patch)

patch-rmdir.txt

michaelhwn commented 2 years ago

Thank you @acommuni, I will be merging your change to the dev branch. If there aren't issues, I will merge the dev branch to the main branch after some tests.

michaelhwn commented 2 years ago

Hi @acommuni, the fix you provided is now pushed into the dev branch, I will merge that to the main branch after some testings. Thanks again!