Orthanc failing to load lua script(linux)


Orthanc is failing to load my lua script and is returning the following error:

E0210 12:19:14.820436 OrthancException.cpp:58] The specified path does not point to a regular file: The path does not point to a regular file: /home/wisdom/route_dicoms.lua

What’s surprising is this is the exact path of where the script is, but Orthanc is failing to read it. What could be wrong? I have tried everything renaming, adding another backslah at the end for specifying the file route and moving the file to some different location but nothing worked.

I am using ubuntu linux. Below are the screenshots of the path in linux and the orthanc.json file lua section.

Screenshotc from 2023-02-10 15-11-07.png

Screenshotc from 2023-02-10 15-05-43.png

Try taking the _ out of the name of your script … I seem to remember I came across something like this recently

(and ensure that the path is local to the Orthanc server - especially important when using containers)

I removed the underscore but it still didn’t work. I had already tried renaming it before but no positive results came out. On ensuring that the path of the script is local to the Orthanc server, the lua script and the orthanc server are already running in the same local machine(localhost) but nothing is working. Is this what you mean by local? Kindly note I am still a noob in networking.

What’s funny is this setup has already been working, just as it is. But now the lua script can’t be read and orthanc is returning an error (specified path does not point to a regular file). It’s quite confusing what has changed when this whole setup was working well initially.

Ok Wisdom, so we deduced that you’re not using docker, just running everything on the same host. Makes life a little easier as we’re only working with Orthanc itself now.

I have found that these Lua error messages are a little spurious and in my experience I do a couple of things (in order)

  1. From orthanc.json, remove reference to the Lua script completely and restart Orthanc. Hopefully it comes up without issues.
  2. If (1) works, create a temporary file (named route_dicom.lua) but with just a simple statement inside it - something like print(“Hello!”) and then restart Orthanc.
  3. If (2) works then you know there’s something inside the script itself which is causing a problem.
  4. If (2) doesn’t work then definitely check the orthanc.json configuration. It should contain something like “LuaScripts” : [“/home/wisdom/route_dicoms.lua”]
    It may also be advisable to put more of the output into a post on this forum as there may be something else which is compounding the issue.

I did all the steps up to step 4 but to no avail. I have tried everything humanly possible. It’s actually now scary if there is actually a solution to this. Below I have attached the orthanc error log file, the error in terminal, screenshot of the temporary lua script, screenshot of the “LuaScripts” section of the orthanc.json configuration file and screenshot of the “DicomModalities” section in the orthanc.json configuration file in case it might have an effect on orthanc reading the lua script.

I have also tried uninstalling and reinstalling orthanc via terminal. Is there a way of completely removing orthanc and starting afresh as uninstalling via terminal using “sudo uninstall orthanc” seems to leave some orthanc files (orthanc storage etc.). Will this even help? Thanks in advance.

Screenshot from 2023-02-11 09-16-25.png

Screenshot from 2023-02-11 09-13-47.png

Orthanc.log.20230211-094630.5356.txt (3.4 KB)

Screenshotc from 2023-02-11 10-14-50.png

Screenshot from 2023-02-11 09-14-20.png

Hi Wisdom,

It seems that Orthanc is able to read the json config files from “/etc/orthanc” folder… What if you put your lua script there and adapt the path in the “LuaScripts” var ?


In the screen shot you have: “/home/wisdom/route.lua/”, with a ‘/’ at the end ? I don’t think you need that. If you have more than one lua script you can add them as additional elements in the array.

Also check the permission for the lua script file.

Stephen D. Scotti

It finally worked. I don’t think it’s about the forward slash and the script permissions issue because I had already tried that. What I now did is I made a new lua file in the linux main root cd directory which need sudo priviledges (sudo touch route_dicoms.lua) and copied everything from my original lua script into this new lua file I have made in the main linux cd directory (opened using sudo gedit route_dicoms.lua/sudo nano route_dicoms.lua). >From the linux main cd directory everything seems to be working fine. I have attached the screenshot of where I have made this new lua script. The root cause still not yet clear to me. Maybe it’s because I once changed my user password for logging into my computer or something to do with sudo priviledges. So the new path is now just “/route_dicoms.lua”. Thanks.

Screenshotc from 2023-02-11 20-35-39.png

Glad that you got it working Wisdom. I tend to put all of my scripts in /usr/share/orthanc/lua-scripts (within a docker container) and as long as they have (at least) 0444 permissions, then all should be able to read them.

I see. This could be a second workaround also if I face the same problem in the future. Thanks.