Skip to content
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

pyRevit Loader Error Revit 2019 pyRevit v4.7.4 #760

Closed
jagostinhoCT opened this issue Nov 27, 2019 · 29 comments
Closed

pyRevit Loader Error Revit 2019 pyRevit v4.7.4 #760

jagostinhoCT opened this issue Nov 27, 2019 · 29 comments
Labels
Heisenbug Bug that is very hard to find [class] Misc Compatibility Compatibility issue with other third-party addons [class->Updated #{number}: {title}]

Comments

@jagostinhoCT
Copy link

getting this error when starting Revit 2019.

pyRevit Loaded Error

@Kaankrby
Copy link

Kaankrby commented Nov 28, 2019

Ek Açıklama 2019-11-28 233411
Similar here.

Not sure if we tried this before or not but open a command prompt and run pyrevit caches clear --all to clear all the exiting caches.

Also look into your pyRevit config file (%APPDATA%/pyRevit/pyRevit_config.ini) and make sure bincache = true

tried this and nothing changes.

Edit; Probably no similarity btw errors except being loading error. :)

@eirannejad
Copy link
Collaborator

Would you please confirm that Xceed.Wpf.AvalonDock.dll exists in the Revit directory?

@Kaankrby
Copy link

I tried these;

Not sure if we tried this before or not but open a command prompt and run pyrevit caches clear --all to clear all the exiting caches. Also look into your pyRevit config file (%APPDATA%/pyRevit/pyRevit_config.ini) and make sure bincache = true

Seems like you are missing the pyRevitLabs.TargetApps.Revit dll. Make sure antivirus doesn't accidentally delete the file and is available under the bin/ directory. Install multiple times if needed to test.

Okay. Which CLI version are you using? run pyrevit --version
Add the installed clone using
pyrevit clones add master "C:\Users\arthur.banks\AppData\Roaming\pyRevit-Master"
Then run the pyrevit env again and verify master is listed under ==> Registered Clones (deployed from archive)
Now reattach the clone to the installed Revits using
pyrevit attach master 277 --installed

Would you please confirm that Xceed.Wpf.AvalonDock.dll exists in the Revit directory?

Yes it exist
image

@jagostinhoCT
Copy link
Author

image
Yes. it is present.

@deddolo
Copy link
Contributor

deddolo commented Dec 4, 2019

I have recently deployed 4.7.4 to my company computers and one user is having this same issue.

EDIT: Clearing the cache with pyrevit caches clear 2019 seems to have solved the issue.

@Kaankrby
Copy link

Kaankrby commented Dec 9, 2019

I have recently deployed 4.7.4 to my company computers and one user is having this same issue.

EDIT: Clearing the cache with pyrevit caches clear 2019 seems to have solved the issue.

No this dosent solved the problem.

@Kaankrby
Copy link

i made a clean install deleted all of the files but still no change.

İ don't know it's normal or not but, after clean install, the config file dosnt contain these lines

[environment]
clones = {"master":"C:\Users\ITopya\AppData\Roaming\pyRevit-Master"}

[core]
checkupdates = false
autoupdate = false
verbose = true
debug = false
filelogging = false
startuplogtimeout = 10
userextensions = []
compilecsharp = true
compilevb = true
loadbeta = false
rocketmode = true
bincache = true
usercanupdate = true
usercanextend = true
usercanconfig = true

[usagelogging]
active = false
logfilepath = ""
logserverurl = ""

[pyRevitTags.extension]
disabled = true
private_repo = true
username = ""
password = ""

[pyRevitTools.extension]
disabled = false
private_repo = true
username = ""
password = ""

[pyRevitTutor.extension]
disabled = true
private_repo = true
username = ""
password = ""

only this one

[environment]
clones = {"master":"C:\Users\ITopya\AppData\Roaming\pyRevit-Master"}

and i added

bincache = true

@Kaankrby
Copy link

Copied these lines to 4.7.4 config file. nothing changed

@eirannejad
Copy link
Collaborator

@Kaankrby There rest of the config lines are added when pyRevit loads for the first time.

@Kaankrby
Copy link

@Kaankrby There rest of the config lines are added when pyRevit loads for the first time.

I don't have any coding skill :) i try what i can.
Still it's not working, using 4,6

@Kaankrby
Copy link

is there any update

@eirannejad
Copy link
Collaborator

Try the new 4.7.5 and see if this has been fixed

@eirannejad eirannejad added Heisenbug Bug that is very hard to find [class] Misc Compatibility Compatibility issue with other third-party addons [class->Updated #{number}: {title}] and removed Under Review labels Mar 16, 2020
@Kaankrby
Copy link

Sorry but still the same
Ek Açıklama 2020-03-18 170137

@eirannejad
Copy link
Collaborator

This might be a conflict with another addon. Try disabling the other addons using this tool and see if pyRevit loads by itself.

@Kaankrby
Copy link

tried but nothing changes.
In turkey, i try in 3 different office and may be 10 pc.
Always the same.

Can be a regional problem.
Some of the pc languege was English too.

wil try with a clean install rvt20

@eirannejad
Copy link
Collaborator

Okay would you mind:

  • Close Revit
  • Open /pyrevitlib/pyrevit/loader/sessionmgr.py in your pyRevit install path (default is %APPDATA%/pyRevit-Master
  • On line 67 Change the _setup_output function to this:
def _setup_output():
    # create output window and assign handle
    with open(op.join(USER_DESKTOP, 'debug.log'), 'w') as f:
        f.writelines(
            "runtime is loaded as: {}"
            "runtime.types is loaded as: {}"
            "runtime.types.ScriptConsole is loaded as: {}\n".format(
                runtime,
                runtime.types,
                runtime.types.ScriptConsole
            ))
        try:
            out_window = runtime.types.ScriptConsole()
        except Exception as ex:
            f.writelines(str(ex))

    out_window = runtime.types.ScriptConsole()
    runtime_info = sessioninfo.get_runtime_info()
    out_window.AppVersion = '{}:{}:{}'.format(
        runtime_info.pyrevit_version,
        runtime_info.engine_version,
        runtime_info.host_version
        )

    # create output stream and set stdout to it
    # we're not opening the output window here.
    # The output stream will open the window if anything is being printed.
    outstr = runtime.types.ScriptIO(out_window)
    sys.stdout = outstr
    # sys.stderr = outstr
    stdout_hndlr = logger.get_stdout_hndlr()
    stdout_hndlr.stream = outstr

    return out_window
  • Then open a command prompt and run pyrevit caches clear --all
  • Run Revit again
  • This time pyRevit should create a debug.log file on your desktop.

Send me that file please

@Kaankrby
Copy link

sdds

code dosn't work.

added

import os

and changed

with open(op.join(op.join(op.join(os.environ['USERPROFILE']), 'Desktop'), 'debug.log'), 'w') as f:

debug.log

*i am not an expert, writing what i am doing.

@eirannejad
Copy link
Collaborator

eirannejad commented Mar 24, 2020

Ugh sorry. Modify line 17 at the top as well:

from pyrevit import EXEC_PARAMS, HOST_APP, USER_DESKTOP

This should work now open(op.join(USER_DESKTOP, 'debug.log')

@eirannejad
Copy link
Collaborator

Okay let me see if I can offer a few more changes to better debug the issue

@Kaankrby
Copy link

Ugh sorry. Modify line 17 at the top as well:

from pyrevit import EXEC_PARAMS, HOST_APP, USER_DESKTOP

This should work now open(op.join(USER_DESKTOP, 'debug.log')

made these.

debug.log

@eirannejad
Copy link
Collaborator

Okay. One more try. Replace the previous function with this:

def _setup_output():
    # create output window and assign handle
    try:
        out_window = runtime.types.ScriptConsole()
    except Exception as ex:
        with open(op.join(USER_DESKTOP, 'debug.log'), 'w') as f:
            f.writelines(ex.clsException.Message)
            f.writelines(ex.clsException.Source)
            f.writelines(ex.clsException.StackTrace)
            f.writelines(ex.clsException.TargetSite.ToString())
    # runtime_info = sessioninfo.get_runtime_info()
    # out_window.AppVersion = '{}:{}:{}'.format(
    #     runtime_info.pyrevit_version,
    #     runtime_info.engine_version,
    #     runtime_info.host_version
    #     )

    # # create output stream and set stdout to it
    # # we're not opening the output window here.
    # # The output stream will open the window if anything is being printed.
    # outstr = runtime.types.ScriptIO(out_window)
    # sys.stdout = outstr
    # # sys.stderr = outstr
    # stdout_hndlr = logger.get_stdout_hndlr()
    # stdout_hndlr.stream = outstr

    # return out_window

Then run again and take a screenshot of the error message that pops up

@Kaankrby
Copy link

Ekran Alıntısı

@eirannejad
Copy link
Collaborator

Ugh. This went somewhere else completely. Hmmmmm. Okay give me time to think a bit

@Kaankrby
Copy link

i think this will help.

windows has a region setting and language setting.

i changed both of them to U.S.
Now my pc thinks i live in U.S and my pc language English too.
And the result.

Annotation 2020-03-25 1458312
Annotation 2020-03-25 145831

Yes its working.
Any problem.

But when i change region to Turkey. Still language is English.

reg2

Ekran Alıntısı

Same issue.

and the last one.

regg

regional settings US

region TURKEY

it works.

ok

This option changes Date format and number format.
and i find;

turkey number:

TURKEY

usa number:

usa

@Kaankrby
Copy link

this wasnt a problem for 4,6
staring with beta of 4,7 this problem occurs.

@Kaankrby
Copy link

english eurpoe

i think the problem dosnt related directly to number decimal symbol.
Because its work for europe too.
And europe is same Turkey

@Kaankrby
Copy link

Kaankrby commented Mar 25, 2020

when all the options are correct, i start revit and pyrevit loads well.
then i change the local to TURKEY.

i reload pyrevit its works well

after close and re open revit again crashes.

@eirannejad
Copy link
Collaborator

Okay great! I can replicate the issue now. Let me dig into it and figure out why this happens

@eirannejad
Copy link
Collaborator

Solved. In C# the method String.ToUpper() uses the active locale so pyRevit was being capitalized as PYREVÍT in Turkish

  • Cancel out all the previous code changes
  • Open pyrevitlib/pyrevit/runtime/EnvVariables.cs
  • Change the .ToUpper() call to .ToUpperInvariant() on lines 11 and 21
namespace PyRevitLabs.PyRevit.Runtime {
    public static class DomainStorageKeys {
        public static string keyPrefix = PyRevitLabsConsts.ProductName.ToUpperInvariant();

        public static string EnvVarsDictKey = keyPrefix + "EnvVarsDict";
        public static string EnginesDictKey = keyPrefix + "CachedEngines";
        public static string IronPythonEngineDefaultStreamCfgKey = keyPrefix + "CachedEngineDefaultStreamCfg";
        public static string OutputWindowsDictKey = keyPrefix + "OutputWindowsDict";
    }

    public static class EnvDictionaryKeys
    {
        public static string keyPrefix = PyRevitLabsConsts.ProductName.ToUpperInvariant();

...

I'll make changes to the code and will publish this fix with the next 4.7.6 release soon

eirannejad added a commit that referenced this issue Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Heisenbug Bug that is very hard to find [class] Misc Compatibility Compatibility issue with other third-party addons [class->Updated #{number}: {title}]
Projects
None yet
Development

No branches or pull requests

4 participants