Skip to content

[Bug]: Startup scripts fail in 6.1 #3108

@Wurschdhaud

Description

@Wurschdhaud

✈ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a similar issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

may have been in 6.0 already

worked without logging a warning in 5.3.1

⌨ Error/Debug Message

WARNING [pyrevit.loader.sessionmgr] Startup script returned non-zero result for extension: MyTools, result: 1

♻️ To Reproduce

No response

⏲️ Expected behavior

No response

🖥️ Hardware and Software Setup (please complete the following information)

master | Branch: "master" | Version: "6.1.0.26047+2255" | Path: "C:\Program Files\pyRevit-Master"

Additional context

import os
import subprocess
from pyrevit import forms, script, EXEC_PARAMS

logger = script.get_logger()
my_config = script.get_config("autoupdate")
if not my_config.get_option("autoupdate", True):
    script.exit()

basepath = os.path.dirname(EXEC_PARAMS.command_path)
command = os.path.join(basepath, "MyTools.extension", "dev", "GetMyToolsFromGit.bat")
BAT_COMMAND = "update"

if not os.path.exists(command):
    forms.alert(
        "Nothing done. Update script not found at:\n{}".format(command),
        title="Updater ERROR",
        exitscript=True,
    )


try:
    task = subprocess.Popen(
        [command, BAT_COMMAND], stdout=subprocess.PIPE, stderr=subprocess.PIPE
    )
    out, err = task.communicate()

    # Log output if present
    if out:
        output_text = out.decode("utf-8") if isinstance(out, bytes) else out
        logger.info("Script output: {}".format(output_text.strip()))

    # Log errors if present
    if err:
        error_text = err.decode("utf-8") if isinstance(err, bytes) else err
        logger.error("Script error: {}".format(error_text.strip()))

    # Check return code and provide feedback
    if task.returncode != 0:
        logger.error(
            "Update script failed with return code: {}".format(task.returncode)
        )
    else:
        logger.info("Update script completed successfully.")

except Exception as e:
    logger.error("Failed to execute update script: {}".format(str(e)))

Metadata

Metadata

Assignees

Labels

BugBug that stops user from using the tool or a major portion of pyRevit functionality [class]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions