Skip to content

Invalid preference reference causing cash after install #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fasavard opened this issue Apr 8, 2025 · 1 comment
Open

Invalid preference reference causing cash after install #147

fasavard opened this issue Apr 8, 2025 · 1 comment

Comments

@fasavard
Copy link

fasavard commented Apr 8, 2025

Hi, I install pyflow on 3 different pc (windows Mac linux),

at every install, when trying to boot the python node, I get this error
Traceback (most recent call last): File "/Users/fred/pyflow_1/.venv/lib/python3.13/site-packages/PyFlow/Packages/PyFlowBase/UI/UIPythonNode.py", line 198, in onEdit tempFilesDir = self.canvasRef().getApp().getTempDirectory() File "/Users/fred/pyflow_1/.venv/lib/python3.13/site-packages/PyFlow/App.py", line 168, in getTempDirectory if tempDirPath[-1:] in ("/", "\\"): ~~~~~~~~~~~^^^^^ TypeError: 'NoneType' object is not subscriptable

I also get a lot of error and weird behaviour

I saw in the code the preference was noted as

` def getTempDirectory(self):
"""Returns unique temp directory for application instance.

    This folder and all its content will be removed from disc on application shutdown.
    """
    if self.currentTempDir == "":
        # create app folder in documents
        # random string used for cases when multiple instances of app are running in the same time
        tempDirPath = ConfigManager().getPrefsValue("PREFS", "General/TempFilesDir")
        if tempDirPath[-1:] in ("/", "\\"):
            tempDirPath = tempDirPath[:-1]
        self.currentTempDir = "{0}_{1}".format(tempDirPath, generateRandomString())

        if not os.path.exists(self.currentTempDir):
            os.makedirs(self.currentTempDir)
    return self.currentTempDir`

Changing every reference for preference from
tempDirPath = ConfigManager().getPrefsValue("PREFS", "General/TempFilesDir")
to
tempDirPath = ConfigManager().getPrefsValue("PREFS", "GeneralPreferences/TempFilesDir")

In the preference.ini the reference is writing as general preference

[GeneralPreferences]
EditorCmd=code @FILE
TempFilesDir=C:\\pyflow\\PyFlow\\tmp
ExtraPackageDirs=my_pakages
HistoryDepth=50
RedirectOutput=true

[ThemePreferences]
Theme_Name=Dark

[DemoPrefs]
ExampleProperty=property value

I don't know if its a proper fix but changing all instance seems to have resolve most of my issue

@fasavard
Copy link
Author

fasavard commented Apr 8, 2025

I did a branch here
https://github.com/fasavard/PyFlow/tree/fix_config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant