Highlighted

Debugging Script in VS Code on PC

Adobe Community Professional ,
Apr 13, 2020

Copy link to clipboard

Copied

Hey there folks. Hope you're safe and isolated with very clean hands.

 

As are many many people, I've been scrambling to expand the availability of my suite of scripts now that our staff is working remotely (but even more frustratingly... on their own personal computers with wildly unpredictable file system setups). For years I had requested a work from home setup, and I had been told in no uncertain terms that WFH was NEVER going to happen. So, naturally, I didn't waste any time worrying about whether my scripts would work outside the building.. I have made my best effort at relegating all file/folder path definitions to the realm of concatenated variables to make it easier to make one change to a root folder without being required to do extensive refactoring. In theory, this made it pretty easy for me to just do an operating system check at the beginning of the script and define the standard network file/folder paths appropriately. (all of the dependencies for my scripts live on a shared server so that none of the artists need to take action when I make an update. This means that when working remote, we must connect via VPN and mount the necessary network drive).

 

Anyway, that's quite enough fluff.. Here's the rub. While the VPN causes the script to run at an excruciatingly slow pace, I have been able to successfully locate and include the necessary dependencies.. However, I'm encountering some silent error(s) in at least one component, but I'm unable to use the step functions in VS Code to identify the problem... The files appear to be successfully included, but if I place a breakpoint at the function call and then try to step into the function, I get an error message (see screenshot) and the script simply quits. The file path in the error message is correct, except for the "c:\Program Files\Microsoft VS Code\:"

 

It appears that VS Code is attempting to save the included file in a temp location during script execution? Does anyone know why VS Code is trying to open the files from the C drive even though I'm explicitly pointing to the network drive? Again, the files are found, and they are included, and the functions contained in those files are accessible by the script.. but only if i let the script run on it's own. If i attempt to see what's going on, the behavior changes... It's a classic "double slit" phenomenon.. The presence of an observer alters the outcome of the experiment.. 

 

Anyone have any advice on how to debug these files from where they are instead of being required to duplicate them locally and change the path? Maybe there's something I can put into the config file to dictate where files get 'stored' during execution?

 

Please help. I'm going to throw my computer through the wall, but I don't actually own the wall or the computer... 😃

 

Thanks, folks.

 

error.png

Topics

Scripting, SDK, Third party plugins

Views

639

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Debugging Script in VS Code on PC

Adobe Community Professional ,
Apr 13, 2020

Copy link to clipboard

Copied

Hey there folks. Hope you're safe and isolated with very clean hands.

 

As are many many people, I've been scrambling to expand the availability of my suite of scripts now that our staff is working remotely (but even more frustratingly... on their own personal computers with wildly unpredictable file system setups). For years I had requested a work from home setup, and I had been told in no uncertain terms that WFH was NEVER going to happen. So, naturally, I didn't waste any time worrying about whether my scripts would work outside the building.. I have made my best effort at relegating all file/folder path definitions to the realm of concatenated variables to make it easier to make one change to a root folder without being required to do extensive refactoring. In theory, this made it pretty easy for me to just do an operating system check at the beginning of the script and define the standard network file/folder paths appropriately. (all of the dependencies for my scripts live on a shared server so that none of the artists need to take action when I make an update. This means that when working remote, we must connect via VPN and mount the necessary network drive).

 

Anyway, that's quite enough fluff.. Here's the rub. While the VPN causes the script to run at an excruciatingly slow pace, I have been able to successfully locate and include the necessary dependencies.. However, I'm encountering some silent error(s) in at least one component, but I'm unable to use the step functions in VS Code to identify the problem... The files appear to be successfully included, but if I place a breakpoint at the function call and then try to step into the function, I get an error message (see screenshot) and the script simply quits. The file path in the error message is correct, except for the "c:\Program Files\Microsoft VS Code\:"

 

It appears that VS Code is attempting to save the included file in a temp location during script execution? Does anyone know why VS Code is trying to open the files from the C drive even though I'm explicitly pointing to the network drive? Again, the files are found, and they are included, and the functions contained in those files are accessible by the script.. but only if i let the script run on it's own. If i attempt to see what's going on, the behavior changes... It's a classic "double slit" phenomenon.. The presence of an observer alters the outcome of the experiment.. 

 

Anyone have any advice on how to debug these files from where they are instead of being required to duplicate them locally and change the path? Maybe there's something I can put into the config file to dictate where files get 'stored' during execution?

 

Please help. I'm going to throw my computer through the wall, but I don't actually own the wall or the computer... 😃

 

Thanks, folks.

 

error.png

Topics

Scripting, SDK, Third party plugins

Views

640

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Apr 13, 2020

Copy link to clipboard

Copied

Hmmm. It occurred to me seconds after I posted this that while I felt like this was a windows only problem (which i forgot to mention in my post) I had not actually tested it on Mac. For clarification, we use Mac in house, but I'm trying to patch everything to work seamlessly in windows as well. So I've been testing via remote desktop on a PC and I thought the issue i mentioned was specific to windows. But I have since tested on my Mac and the issue occurs in an identical fashion. So I guess this turned out to be more of a VS Code specific question..

 

Anywho.. While I still get the same error message on Mac, the contents of the message are different. On mac, the error message does not include any reference to the VS Code application (in the other error message, the file path was preceded by a path to the program files folder). The path appears correct, even though the error still occurs. This is weird. Is this weird?

 

Screen Shot 2020-04-13 at 12.07.54 PM.jpg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Apr 13, 2020

Copy link to clipboard

Copied

Hi William, so you're on Windows but you're connecting remotely to Mac Catalina?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Apr 13, 2020

Copy link to clipboard

Copied

I'm remoting into a windows machine from a Mac so that I can test how the scripts behave in a windows environment. 

 

While doing that testing I realized that I'm unable to step into a function if it was included from a mounted drive. I initially assumed it was a windows issue, but it seems at this point that it may be a permissions issue? Since stepping into a function that  was included from a file requires opening that file in the editor, I'm guessing that the file system may be seeing vs code as an unauthorized user and not granting permission to read the file?

 

I'm going to try to clone the dependencies locally so that I can test whether it will work if the files are hosted locally on the machine.. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Apr 13, 2020

Copy link to clipboard

Copied

I don't have an answer. I just know Catalina has issues with file system, but I'm on windows, I can't troubeshoot.

 

about your first issue, vscode pointing somewhere else on windows. If the path is not found, it defaults to the install folder, in your case it is vscode. The same happens when we do BridgeTalk and files are not found, the folder defaults to the Illustrator install folder.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Apr 14, 2020

Copy link to clipboard

Copied

Isn't it odd though that the files do exist and they are properly included, but when vs code tries to display the file, suddenly the file "doesn't exist"?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Apr 14, 2020

Copy link to clipboard

Copied

I am sorry to hear about the challenge and MORE sorry I don't have an answer. I am dealing with similar challenges supporting 5 @home artists using extensive in-house scripts (funny how "working from home" wasn't an option until it was the ONLY option). What is working for us is a shared OneDrive folder. I had been working at home with Dropbox for over a year so transitioning to OneDrive was not a big deal. This approach keeps the access local while data is continually synced. It is working surprisingly well. I too, have written the path variables to be easily updated. Keyboard Maestro also helps in this regard,  helping me do things I just don't know how to script. If you're interested in learning more about this setup please let me know.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...