Skip to main content
Post Reopened by PolyGeo
edited tags; edited title
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

How do I tell an Getting ArcGIS Pro Toolbox to use a relative path to a Python script file?

Restated the heading as a question.
Source Link
Cowirrie
  • 715
  • 3
  • 9

How do I tell an ArcGIS Pro Toolbox always using absoluteto use a relative path to a Python script file?

I have a multiple Python scripts that act as geoprocessing tools. I have an ArcGIS Pro Toolbox (.atbx format) defining how to call them. The scripts are in a subdirectory of the location where the .atbx file is stored. I want to be able to move around the directory containing the .atbx file and .py files and have them go on working.

According to the ArcGIS Pro documentation Add a script tool:

If your toolbox is an ArcGIS toolbox (.atbx), this behavior is managed differently. If the script is in the same directory as the .atbx file or is in a child folder from where the .atbx is stored, a relative path is maintained. If the script and .atbx file are completely separate, an absolute path is maintained.

However, I have not seen this happen as described above. I have tried putting the .py files in various locations, including the same folder as the .atbx file. The path to the .py file is always absolute.

I see that the .atbx file format is a zipped archive where each tool gets a .tool directory containing a file called tool.script.execute.link. I have opened this after trying various .py locations and it always shows an absolute path. I tried manually editing it to use a relative path, but the next time I modified anything about the tool in the .atbx file it switched back to an absolute path.

My organisation is using ArcGIS Pro 2.9 for compatibility reasons, if this makes a difference.

My question: ifSo, can I wantget these .atbx files to keep the scripts and the toolbox instore a directory I can move around, what arerelative path to my optionsscripts?

Other options if ArcGIS Pro simply won't do this with .atbx files:

  • The scripts are long and under version control, so I don't consider storing them inside the .atbx satisfactory.
  • I could use the legacy toolbox (.tbx) format, but this may be removed from some future version of ArcGIS Pro.
  • In similar circumstances I have used the Python Toolbox (.pyt) format and it has been unwieldy but functional. It remains an option if there is no way to use the .atbx.

ArcGIS Pro Toolbox always using absolute path to Python script file

I have a multiple Python scripts that act as geoprocessing tools. I have an ArcGIS Pro Toolbox (.atbx format) defining how to call them. The scripts are in a subdirectory of the location where the .atbx file is stored. I want to be able to move around the directory containing the .atbx file and .py files and have them go on working.

According to the ArcGIS Pro documentation Add a script tool:

If your toolbox is an ArcGIS toolbox (.atbx), this behavior is managed differently. If the script is in the same directory as the .atbx file or is in a child folder from where the .atbx is stored, a relative path is maintained. If the script and .atbx file are completely separate, an absolute path is maintained.

However, I have not seen this happen as described above. I have tried putting the .py files in various locations, including the same folder as the .atbx file. The path to the .py file is always absolute.

I see that the .atbx file format is a zipped archive where each tool gets a .tool directory containing a file called tool.script.execute.link. I have opened this after trying various .py locations and it always shows an absolute path. I tried manually editing it to use a relative path, but the next time I modified anything about the tool in the .atbx file it switched back to an absolute path.

My organisation is using ArcGIS Pro 2.9 for compatibility reasons, if this makes a difference.

My question: if I want to keep the scripts and the toolbox in a directory I can move around, what are my options?

  • The scripts are long and under version control, so I don't consider storing them inside the .atbx satisfactory.
  • I could use the legacy toolbox (.tbx) format, but this may be removed from some future version of ArcGIS Pro.
  • In similar circumstances I have used the Python Toolbox (.pyt) format and it has been unwieldy but functional. It remains an option if there is no way to use the .atbx.

How do I tell an ArcGIS Pro Toolbox to use a relative path to a Python script file?

I have a multiple Python scripts that act as geoprocessing tools. I have an ArcGIS Pro Toolbox (.atbx format) defining how to call them. The scripts are in a subdirectory of the location where the .atbx file is stored. I want to be able to move around the directory containing the .atbx file and .py files and have them go on working.

According to the ArcGIS Pro documentation Add a script tool:

If your toolbox is an ArcGIS toolbox (.atbx), this behavior is managed differently. If the script is in the same directory as the .atbx file or is in a child folder from where the .atbx is stored, a relative path is maintained. If the script and .atbx file are completely separate, an absolute path is maintained.

However, I have not seen this happen as described above. I have tried putting the .py files in various locations, including the same folder as the .atbx file. The path to the .py file is always absolute.

I see that the .atbx file format is a zipped archive where each tool gets a .tool directory containing a file called tool.script.execute.link. I have opened this after trying various .py locations and it always shows an absolute path. I tried manually editing it to use a relative path, but the next time I modified anything about the tool in the .atbx file it switched back to an absolute path.

My organisation is using ArcGIS Pro 2.9 for compatibility reasons, if this makes a difference.

So, can I get these .atbx files to store a relative path to my scripts?

Other options if ArcGIS Pro simply won't do this with .atbx files:

  • The scripts are long and under version control, so I don't consider storing them inside the .atbx satisfactory.
  • I could use the legacy toolbox (.tbx) format, but this may be removed from some future version of ArcGIS Pro.
  • In similar circumstances I have used the Python Toolbox (.pyt) format and it has been unwieldy but functional. It remains an option if there is no way to use the .atbx.
As first stated contained two questions. Focussed on one.
Added to review
Source Link
Cowirrie
  • 715
  • 3
  • 9

I have a multiple Python scripts that act as geoprocessing tools. I have an ArcGIS Pro Toolbox (.atbx format) defining how to call them. The scripts are in a subdirectory of the location where the .atbx file is stored. I want to be able to move around the directory containing the .atbx file and .py files and have them go on working.

According to the ArcGIS Pro documentation Add a script tool:

If your toolbox is an ArcGIS toolbox (.atbx), this behavior is managed differently. If the script is in the same directory as the .atbx file or is in a child folder from where the .atbx is stored, a relative path is maintained. If the script and .atbx file are completely separate, an absolute path is maintained.

However, I have not seen this happen as described above. I have tried putting the .py files in various locations, including the same folder as the .atbx file. The path to the .py file is always absolute.

I see that the .atbx file format is a zipped archive where each tool gets a .tool directory containing a file called tool.script.execute.link. I have opened this after trying various .py locations and it always shows an absolute path. I tried manually editing it to use a relative path, but the next time I modified anything about the toolboxtool in the .atbx file it switched back to an absolute path.

My organisation is using ArcGIS Pro 2.9 for compatibility reasons, if this makes a difference.

My questionsquestion: if I want to keep the scripts and the toolbox in a directory I can move around, what are my options?

  1. Do other people see ArcGIS Pro do this?
  2. If I want to keep the scripts and the toolbox in a directory I can move around, what are my options?
    • The scripts are long and under version control, so I don't consider storing them inside the .atbx satisfactory.
    • I could use the legacy toolbox (.tbx) format, but this may be removed from some future version.
    • In similar circumstances I have used the Python Toolbox (.pyt) format and it has been unwieldy but functional. Should I be using that here?
  • The scripts are long and under version control, so I don't consider storing them inside the .atbx satisfactory.
  • I could use the legacy toolbox (.tbx) format, but this may be removed from some future version of ArcGIS Pro.
  • In similar circumstances I have used the Python Toolbox (.pyt) format and it has been unwieldy but functional. It remains an option if there is no way to use the .atbx.

I have a multiple Python scripts that act as geoprocessing tools. I have an ArcGIS Pro Toolbox (.atbx format) defining how to call them. The scripts are in a subdirectory of the location where the .atbx file is stored. I want to be able to move around the directory containing the .atbx file and .py files and have them go on working.

According to the ArcGIS Pro documentation Add a script tool:

If your toolbox is an ArcGIS toolbox (.atbx), this behavior is managed differently. If the script is in the same directory as the .atbx file or is in a child folder from where the .atbx is stored, a relative path is maintained. If the script and .atbx file are completely separate, an absolute path is maintained.

However, I have not seen this happen as described above. I have tried putting the .py files in various locations, including the same folder as the .atbx file. The path to the .py file is always absolute.

I see that the .atbx file format is a zipped archive where each tool gets a .tool directory containing a file called tool.script.execute.link. I have opened this after trying various .py locations and it always shows an absolute path. I tried manually editing it to use a relative path, but the next time I modified the toolbox it switched back to an absolute path.

My organisation is using ArcGIS Pro 2.9 for compatibility reasons, if this makes a difference.

My questions:

  1. Do other people see ArcGIS Pro do this?
  2. If I want to keep the scripts and the toolbox in a directory I can move around, what are my options?
    • The scripts are long and under version control, so I don't consider storing them inside the .atbx satisfactory.
    • I could use the legacy toolbox (.tbx) format, but this may be removed from some future version.
    • In similar circumstances I have used the Python Toolbox (.pyt) format and it has been unwieldy but functional. Should I be using that here?

I have a multiple Python scripts that act as geoprocessing tools. I have an ArcGIS Pro Toolbox (.atbx format) defining how to call them. The scripts are in a subdirectory of the location where the .atbx file is stored. I want to be able to move around the directory containing the .atbx file and .py files and have them go on working.

According to the ArcGIS Pro documentation Add a script tool:

If your toolbox is an ArcGIS toolbox (.atbx), this behavior is managed differently. If the script is in the same directory as the .atbx file or is in a child folder from where the .atbx is stored, a relative path is maintained. If the script and .atbx file are completely separate, an absolute path is maintained.

However, I have not seen this happen as described above. I have tried putting the .py files in various locations, including the same folder as the .atbx file. The path to the .py file is always absolute.

I see that the .atbx file format is a zipped archive where each tool gets a .tool directory containing a file called tool.script.execute.link. I have opened this after trying various .py locations and it always shows an absolute path. I tried manually editing it to use a relative path, but the next time I modified anything about the tool in the .atbx file it switched back to an absolute path.

My organisation is using ArcGIS Pro 2.9 for compatibility reasons, if this makes a difference.

My question: if I want to keep the scripts and the toolbox in a directory I can move around, what are my options?

  • The scripts are long and under version control, so I don't consider storing them inside the .atbx satisfactory.
  • I could use the legacy toolbox (.tbx) format, but this may be removed from some future version of ArcGIS Pro.
  • In similar circumstances I have used the Python Toolbox (.pyt) format and it has been unwieldy but functional. It remains an option if there is no way to use the .atbx.
Post Closed as "Needs more focus" by PolyGeo
Source Link
Cowirrie
  • 715
  • 3
  • 9
Loading