Dealing with Symbolcache
-
btw, I tried to overwrite Symbolcache file when a plugin is open the first time by utilizing this code
c4d.storage.GeGetStartupWritePath() path = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_PREFS) path += r"\symbolcache" with open(path, 'w') as symbolcache: symbolcache.write("")
It worked when I tested it, but it seems like my computer was an expectation since it failed on my clients' pcs.
They provided this bug report.
seems like
c4d.storage.GeGetC4DPath(c4d.C4D_PATH_PREFS)
provides wrong directory. -
May be there is unicode symbols problem. Try this
f = open(fn.decode("utf-8"))
-
'open' or any other pure python function needs to be decoded as utf8.
See hint here: https://developers.maxon.net/docs/py/2023_2/modules/c4d.storage/index.html?highlight=loaddialog#c4d.storage.LoadDialog
Edit: a little late.
-
Thanks, folks!
I'll double-check this. -
Hi @merkvilson, symbolcache is as the name says, a cache version of the symbols in order to speed up the startup of Cinema 4D.
So delete it each time you launch your plugin is really not recommended and could cause some issues (missing symbols and so on, since python is available after the generation of the symbolcache). While we do understand the issue, we don't have any workaround to it.
Regarding the issue, this is mostly due to utf8 handling as @mikeudin pointed.The best way is to "educate your customer".
- Launch Cinema 4D.
- Open the preference.
- Click on the bottom button "Open Preference".
- Go to the pref folder.
- Delete the symbolcache.
- Restart Cinema 4D.
Cheers,
Maxime. -
Thanks, m_adam. I know about this way. I already include this gif to all my plugins but customers are still complaining, and I need to automate this process.
Btw, am I the only one who has this problem? I've never seen anything like this in others' plugins.
I tested plenty of 3rd party plugins with all its updates, but I never had to delete Symbolcache or alter the prefs directly in any way. -
It's not necessary to delete Symbolcache each time when I launch the plugin.
I will create a simple txt file with the basic info in prefs directory via my plugin.
plugin will check if this txt file is created. if not, then it will create it. if created, then it will check the info about the versions of my plugins. if the version is updated, then it will delete the symbolcache. I hope this gonna work. -
Hi @merkvilson, after more investigation here is the current behavior.
SymbolCache is only monitoring filename, so here is the condition to update the symbolcache file:- The name of the resource file is new.
- The name of the resource file is removed.
Any modifications of the content of your resource files are not taking into account (aka not updated to the symbols cache)
So another solution for you could be to rename your resource files for each release of your plugin where the content of your file actually changed.
With that's said I've filled a feature request to our development team, to monitor change in files as well.
Cheers,
Maxime. -
@m_adam
Thank you, Maxime for taking your time into it! You're doing a great job!I was struggling with Symbolcache for a long time.
Currently, I'm writing a custom module for it.
btw, what's the best way of importing custom modules into
.pyp/.pypv
Files? As I remember from the old forum, unlike the usual importing process, there is some condition in.pyp/.pypv
files which we should take into account. -
While the final goal is the same, please open a new thread for your question regarding import
Cheers,
Maxime. -
Hi with the latest update of Cinema 4D (R24 SP1),
any update to a description files should now be reflected correctly to the symbolcache files, so it's not needed to delete it manually anymore.Cheers,
Maxime.