Keyboard Shortcuts
Likes
Search
Issues running LTspice as a batch service
I have a python program kicking off LTspice as a background windows process with the following command.
?
process = await asyncio.create_subprocess_exec(LTSPICE_PATH, "-b", "-run", solverFlag, fpath, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
?
I am running this process on a server and when I run it as my user account everything works as expected. Now I need to have it run as a windows service which requires a service account. I set this up and tried running but I get messages that symbols are missing from the simulation. I figured maybe the .ini file in the service account's folder was missing the symbol and library search paths so I made sure to match the .ini file in my service account's AppData/Roaming folder to match the one on my account. Unfortunately this did not help. Does anyone know why running in batch mode as a service account it would fail to look in the search paths? |
On Tue, Feb 25, 2025 at 08:32 PM, Jeff Kayzerman wrote:
This is only a guess here.? But I suspect you have defined User folders for your symbols and models, which reside in one of your account's folders, perhaps under its "Documents" folder or "AppData" or whatever.? The other account does not have the same folders.? Well, it has the same-named folders but they are distinct for each Windows user.? So it does not see the same library areas. ?
The settings in the .ini file are relative to each Windows account's folders, as managed by MS-Windows.? Windows does a good job of hiding their actual physical locations.
?
Andy
? |
开云体育This is a good example in support of the file management strategy of including all symbols (and models and whatnot) that are not part of the LTspice installation in the same directory (folder) as the schematic which uses/invokes them. Doing so ensures that all files that the simulation needs are available to whichever user (or other entity) is going to use the simulation. Donald. On 2/25/25 22:08, Andy I via groups.io
wrote:
|
开云体育Did you change your schematic and model references to NOT use the absolute locations? e.g. use ".include bunchOfModels.mod" rather than ".include \Home\Users\MyName\MyLibs\bunchOfModels.mod" A web search on that error (and on the equivalent 0xc0000409)
suggests stack overflow in the process; not sure how that might
help you, but there it is. FWIW. Most appropriate link I found is
whose OP found was a referenced file had an o-umlaut in its name. Donald. On 2/26/25 13:49, Jeff Kayzerman wrote:
|
I tried putting all the symbols under the same folder as the simulation. Let me try to better describe what I am doing.
?
A python service is polling an AWS message queue for incoming instructions to run a job. The message has the location of a simulation file in AWS S3. Python pulls the .asc file and kicks off LTspice with the provided command line interface using this line of code?
process = await asyncio.create_subprocess_exec(LTSPICE_PATH, "-b", "-run", solverFlag, fpath, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
*NOTE* -b for batch mode, no interactive gui
?
That code kicks off LTspice as an async process. I have a callback function which runs when the process finishes that zips up the output files and places them back into AWS S3. The user is then emailed the status of their job and the location of their files.
?
All of this works great!
?
What isn't working is when I try to run this process as a windows service. The python is running properly but kicking off LTspice results in this error code 3221226505 so I get an email saying "Simulation failed with status code 3221226505".
?
Since there is no descriptive error message I have no idea why everything works fine when I run it while I'm logged in but it won't run as a background service. I need it to run as a background service because the server won't let a user stay logged in indefinitely.
|
On Thu, Feb 27, 2025 at 01:31 PM, Jeff Kayzerman wrote:
Presumably that is a Windows status code.? I think it did not come from LTspice, but it might mean Windows is telling you that LTspice did not exit happily. ?
Can you find what that error code means, if it's from Windows?
?
It's curious that the message states "Simulation failed ...".? Where did that word "Simulation" come from?
?
Did LTspice create a .LOG file?? What does it say?
?
I am unfamiliar with running programs in a Windows background service.? Is it possible that a background service does not "see" itself with a normal default directory?? Is it a mirror of the right directory, including all contents?? What about its environment variables?? Does it see the LTspice .ini file too? ?
I'm assuming that everything works now that you moved all the symbols (and models too?) into the same folder with the schematic, when run normally.? I think that is what you said.
?
Andy
? |
On Thu, Feb 27, 2025 at 10:31 AM, Jeff Kayzerman wrote:
Suggestion..
?
Create a batch or command file and run a command within it, so it gets the windows environment variables while running as a service.
Redirect the results to a file. It might be telling....
? |
Convert the error number to hex.
Then Google is your friend.
The Windows error code 0xc0000409 is a software exception error that can occur when an application is installed incorrectly ?
?
Sent:?Thursday, February 27, 2025 at 1:54 PM
From:?"Andy I via groups.io" <AI.egrps+io@...> To:[email protected] Subject:?Re: [LTspice] Issues running LTspice as a batch service On Thu, Feb 27, 2025 at 01:31 PM, Jeff Kayzerman wrote:
Presumably that is a Windows status code.? I think it did not come from LTspice, but it might mean Windows is telling you that LTspice did not exit happily. ?
Can you find what that error code means, if it's from Windows?
?
It's curious that the message states "Simulation failed ...".? Where did that word "Simulation" come from?
?
Did LTspice create a .LOG file?? What does it say?
?
I am unfamiliar with running programs in a Windows background service.? Is it possible that a background service does not "see" itself with a normal default directory?? Is it a mirror of the right directory, including all contents?? What about its environment variables?? Does it see the LTspice .ini file too? ?
I'm assuming that everything works now that you moved all the symbols (and models too?) into the same folder with the schematic, when run normally.? I think that is what you said.
?
Andy
?
|
On Thu, Feb 27, 2025 at 11:15 AM, Jeff Kayzerman wrote:
You'll need to launch the python LTspice subprocess in the context of the target user and target schematic source folder. |
开云体育I thought that the advice was that it was not
installed in the right place, but I might be wrong.'Not
installed correctly' might be a paraphrase of 'I can't open it'. On 2025-02-27 19:59, Jeff Kayzerman
wrote:
--
OOO - Own Opinions only If something is true: * as far as we know - it's science *for certain - it's mathematics *unquestionably - it's religion |