DunHouGo / Boghma-Plugin-HUB

A Cinema 4D plugin to manage and update my plugins.
https://www.boghma.com/
13 stars 0 forks source link

Path concatenation error in Plugin Manager? #1

Open mdreynes opened 9 months ago

mdreynes commented 9 months ago

Hi, I have this error when I launch Cinema4D:

Traceback (most recent call last): File "/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager/Plugin Manager.pypv", line 714, in Execute File "/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager/Plugin Manager.pypv", line 74, in init File "/_MAXON/Common Plugins R25 Development/boghma hub/libs/boghma/utils.py", line 72, in init assert os.path.exists(cst_file_path), f"cst_file_path not exists. '{cst_file_path}'" AssertionError: cst_file_path not exists. '~/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager\res\main.cst'

~/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager\res\main.cst

it seems there is an error joining the plugin path and the other part of the string. I am on MacOs

DunHouGo commented 9 months ago

Hi there, Unfortunately, none of us use Macs, and no one has a Mac computer, so there is no path to adapt to Mac. If you are an experienced Mac user and Python user, you are very welcome to improve the code. We can merge it into the boghma library. If you have any questions, please feel free to contact me.

Cheers~ DunHou

王敦厚 @.***

 

------------------ 原始邮件 ------------------ 发件人: "DunHouGo/Boghma-Plugin-HUB" @.>; 发送时间: 2023年12月12日(星期二) 凌晨4:10 @.>; @.***>; 主题: [DunHouGo/Boghma-Plugin-HUB] Path concatenation error in Plugin Manager? (Issue #1)

Hi, I have this error when I launch Cinema4D:

Traceback (most recent call last): File "/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager/Plugin Manager.pypv", line 714, in Execute File "/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager/Plugin Manager.pypv", line 74, in init File "/_MAXON/Common Plugins R25 Development/boghma hub/libs/boghma/utils.py", line 72, in init assert os.path.exists(cst_file_path), f"cst_file_path not exists. '{cst_file_path}'" AssertionError: cst_file_path not exists. '/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager\res\main.cst'

~/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager\res\main.cst

it seems there is an error joining the plugin path and the other part of the string. I am on MacOs

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

mdreynes commented 9 months ago

Hi there, Unfortunately, none of us use Macs, and no one has a Mac computer, so there is no path to adapt to Mac. If you are an experienced Mac user and Python user, you are very welcome to improve the code. We can merge it into the boghma library. If you have any questions, please feel free to contact me. Cheers~ DunHou 王敦厚 @.   ------------------ 原始邮件 ------------------ 发件人: "DunHouGo/Boghma-Plugin-HUB" @.>; 发送时间: 2023年12月12日(星期二) 凌晨4:10 @.>; @.>; 主题: [DunHouGo/Boghma-Plugin-HUB] Path concatenation error in Plugin Manager? (Issue #1) Hi, I have this error when I launch Cinema4D: Traceback (most recent call last): File "/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager/Plugin Manager.pypv", line 714, in Execute File "/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager/Plugin Manager.pypv", line 74, in init File "/_MAXON/Common Plugins R25 Development/boghma hub/libs/boghma/utils.py", line 72, in init assert os.path.exists(cst_file_path), f"cst_file_path not exists. '{cst_file_path}'" AssertionError: cst_file_path not exists. '/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager\res\main.cst' ~/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager\res\main.cst it seems there is an error joining the plugin path and the other part of the string. I am on MacOs — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

I am a Mac and Python user, but I'm not used to Github forking and merging ;) so I list the modification of utils.py I made:

import platform
def __init__(self, host_obj, cst_file_path: str = None):
    if cst_file_path:
        cst_file_path = cst_file_path.replace("\\", "/").replace("\r", "/r")
    assert os.path.exists(cst_file_path), f"cst_file_path not exists. '{cst_file_path}'"
    assert cst_file_path.endswith(".cst"), f"cst_file_path must endswith '.cst'.  not '{cst_file_path}'"

    with open(cst_file_path, "r", encoding="UTF-8") as file:
        self.data = file.read()
    file.close()

    self._host_obj = host_obj
    self._convert_data = {}
    self._convert()
    self._lan = 0
def join(self, *args):
    os = platform.system()
    if os == "Darwin":
        return f"{self.plugin_path}/" + "/".join(args)

    return f"{self.plugin_path}\\" + "\\".join(args)
DunHouGo commented 9 months ago
        Hi there,

I had share this email with jack, the utils and cst lib( now we suggest using trs) is dev bt jack @***@***.***, if you have some post you can directly email him and of cause me is welcomed.thanks for your codes!Cheers~DunHou

                    DunHouMotion ***@***.***

---- Replied Message ----

     From 

        ***@***.***>

     Date 

    12/12/2023 22:12

     To 

        ***@***.***>

     Cc 

        ***@***.***>
        ,

        ***@***.***>

     Subject 

          Re: [DunHouGo/Boghma-Plugin-HUB] Path concatenation error in Plugin Manager? (Issue #1)

Hi there, Unfortunately, none of us use Macs, and no one has a Mac computer, so there is no path to adapt to Mac. If you are an experienced Mac user and Python user, you are very welcome to improve the code. We can merge it into the boghma library. If you have any questions, please feel free to contact me. Cheers~ DunHou 王敦厚 @.***   … ------------------ 原始邮件 ------------------ 发件人: "DunHouGo/Boghma-Plugin-HUB" @.>; 发送时间: 2023年12月12日(星期二) 凌晨4:10 @.>; @.>; 主题: [DunHouGo/Boghma-Plugin-HUB] Path concatenation error in Plugin Manager? (Issue #1) Hi, I have this error when I launch Cinema4D: Traceback (most recent call last): File "/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager/Plugin Manager.pypv", line 714, in Execute File "/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager/Plugin Manager.pypv", line 74, in init File "/_MAXON/Common Plugins R25 Development/boghma hub/libs/boghma/utils.py", line 72, in init assert os.path.exists(cst_file_path), f"cst_file_path not exists. '{cst_file_path}'" AssertionError: cst_file_path not exists. '/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager\res\main.cst' ~/_MAXON/Common Plugins R25 Development/boghma hub/Cinema4d Plugins/Plugin Manager\res\main.cst it seems there is an error joining the plugin path and the other part of the string. I am on MacOs — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>

I am a Mac and Python user, but I'm not used to Github forking and merging ;) so I list the modification of utils.py I made:

I've added this line at the import lines at the beginning:

import platform

I've changed the CustomSymbolsText class init with:

def init(self, host_obj, cst_file_path: str = None): if cst_file_path: cst_file_path = cst_file_path.replace("\", "/").replace("\r", "/r") assert os.path.exists(cst_file_path), f"cst_file_path not exists. '{cst_file_path}'" assert cst_file_path.endswith(".cst"), f"cst_file_path must endswith '.cst'. not '{cst_file_path}'"

with open(cst_file_path, "r", encoding="UTF-8") as file:
    self.data = file.read()
file.close()

self._host_obj = host_obj
self._convert_data = {}
self._convert()
self._lan = 0

I've changed the Prefrence class join method with:

def join(self, *args): os = platform.system() if os == "Darwin": return f"{self.plugin_path}/" + "/".join(args)

return f"{self.plugin_path}\\" + "\\".join(args)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>