Skip to content

Invalid preference reference causing cash after install #147

@fasavard

Description

@fasavard

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions