Very basic extension issue

I am new to PyRevit.

I am making a PyRevit extension.

The extension is found by PyRevit, but when I click the pushbutton, I get an alert from pyrevit loader that says “Can not find Target file. Maybe Deleted?”

I have a script.py file in the pushbutton directory (see below).

Why am I getting this error? How can I troubleshoot it and correct it?

PyRevit Extension Problem

Oh, BTW I am using Revit 2024 with the PyRevit WIP from about two days ago.

Hi,
Welcome @pdneural

Can you take a screen capture of the error?

Which extensions folder is your pyRevit pointing to?
It should point to the folder containing the .extension folder.
In your case ‘PyRevit Extensions’.

To get this information you can either go to the pyrevit settings in the Revit UI or run the ‘pyrevit env’ command in a command line window.

Wow, thanks so much for your prompt reply. I appreciate it!

Here’s my env. Looks like the extensions are being detected properly, no?

C:\Users\pauldavis>pyrevit env
==> Registered Clones (full git repos)
==> Registered Clones (deployed from archive/image)
master | Deploy: “basepublic” | Branch: “master” | Version: “4.8.13.23126+1635-wip” | Path: “C:\Users\pauldavis\AppData\Roaming\pyRevit-Master”
==> Attachments
master | Product: “Autodesk Revit 2024” | Engine: IPY277 (277) | Path: “C:\Users\pauldavis\AppData\Roaming\pyRevit-Master”
==> Installed Extensions
Nedra | Type: Unknown | Repo: “” | Installed: “C:\Program Files\PyRevit Extensions\Nedra.extension”
Test | Type: Unknown | Repo: “” | Installed: “C:\Program Files\PyRevit Extensions\Test.extension”
==> Default Extension Search Path
C:\Users\pauldavis\AppData\Roaming\pyRevit\Extensions
==> Extension Search Paths
C:\Program Files\PyRevit Extensions
==> Extension Sources - Default
https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
Autodesk Revit 2024 | Version: 24.0.5.432 | Build: 20230411_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2024"
==> Running Revit Instances
==> User Environment
Microsoft Windows 10 [Version 10.0.22621]
Executing User: PAULDAVIS1FD7\pauldavis
Active User: PAULDAVIS1FD7\pauldavis
Admin Access: No
%APPDATA%: “C:\Users\pauldavis\AppData\Roaming”
Latest Installed .Net Framework: 4.8
No .Net Target Packs are installed.
No .Ne-Core Target Packs are installed.

And I see the tabs etc. in the Revit UI:
extensions in revit ui

Correct, the detection seems to work fine.

It usually gives the location of the error in the process of creating the toolbar buttons @pdneural

Oh, and sorry! Here’s the alert:

extension error

Do you have bundle.yaml files somewhere in the Test.extension folder or subfolders?

if so, try to remove these (you may have mistyped something in and they are not required by default, they are just helping you with organisation, tooltips and context setup)
and reload

No bundle.yaml. It’s only nested folders, no files, from PyRevit Extensions down to this:
no yaml file

One more note: Running in Parallels on a Mac. Probably not relevant, but a little data point…

Thanks so much for your great project and your help. I appreciate it.

not my project :wink: Ehsan’s it is. I just help out maintaining, supporting and improving it eventually.

I doubt running in VM or Mac is an issue such as this one.
it’s weird, can you share a zip file of your .extension folder for me to try it out.

You can find the zipped tree and files here: Upload files for free - Test.extension.zip - ufile.io

Thanks so much!

Could it be caused by the script being in a tree under Program Files? Could that affect permissions or visibility?

hi @pdneural - its cause your script is a text file rather than a script.py file - if you remove the “.txt” extension from the python file it should work - or better yet - save it as a Python file using Notepad++\ VsCode

2 Likes

image

:slight_smile: :roll_eyes:
that was a fun one ;p

1 Like

Oh, man. That’s a great catch. As you see, in my File Explorer, it shows up as script.py.

I think that inaccurate representation is used by some Windows malware.

In addition to being new to PyRevit, and to Revit, I have not used Windows for a long time.

Thanks so, so much for your attention and persistence.

check this out

1 Like

Great, thanks. I should have said inaccurate default representation…

Really appreciate your help.

We all have to start somewhere ;).
I’m already just started a month or so ago on my python/pyrevit journey.

It’s bumpy road from time to time but a very fun one at that :smiley: !

2 Likes