So, question: can we set Spine itself to export with the .spine-json extension, or do we need to run the convert.py script every time we export from Spine?

You can set the file extension when you export from Spine. Unity users have been doing this for a long time. The script is needed just to keep everything in an existing project intact when the files are renamed.

a month later
Nate wrote

You can set the file extension when you export from Spine. Unity users have been doing this for a long time. The script is needed just to keep everything in an existing project intact when the files are renamed.

Hello Nate, thanks for the good news 🙂

I have been learning the new method to export-import, and I have some questions if you can help me:

1) If we export the project and manually change the .json for .spine-json , and then if we load the new .spine-json to the spineskeletondataresource.tres should be ok ¿right?

2) Does this new spine runtime has a bug fixed list, or it just fixes this issue? Do you recommend us to switch to the new runtime if we have a game in development?

3) Unfortunately, I have never used Python, so I don't know how to do this step:

Run the script on the command line, providing it with the full path to your Godot project directory, e.g. python convert.py c:\myproject

If it's possible, can you explain a little bit how to do that? Do I run Python and the run this command?

Thanks a lot for the Spine-Godot update 🙂

  1. Yeah, that's exactly how it works.

  2. We have extensive documentation on versioning. The TL;DR: pick an editor version (the current stable release 4.1.x) and the corresponding runtime (4.1 branch). You can savely keep updating the runtime code whenever a new commit hits the runtime repository branch. If you want to upgrade from one x.y version to the next, e.g. if we release a new stable editor release, you will have to re-export your assets and update the runtime to the code in the corresponding x.y branch. For Godot, you can simply get the latest binary release we publish.

  3. Assuming you have installed Python in C:\Python, are running Windows, your project resides in C:\myproject, and the file convert.py is in C:\myproject:

  4. Press the Windows key and enter cmd + Enter. A window will pop up within which you can type.

  5. Type C:\Python\bin\python C:\myproject\convert.py C:\myproject and press enter.

Mario wrote

1. Yeah, that's exactly how it works.

  1. We have extensive documentation on versioning. The TL;DR: pick an editor version (the current stable release 4.1.x) and the corresponding runtime (4.1 branch). You can savely keep updating the runtime code whenever a new commit hits the runtime repository branch. If you want to upgrade from one x.y version to the next, e.g. if we release a new stable editor release, you will have to re-export your assets and update the runtime to the code in the corresponding x.y branch. For Godot, you can simply get the latest binary release we publish.

  2. Assuming you have installed Python in C:\Python, are running Windows, your project resides in C:\myproject, and the file convert.py is in C:\myproject:

  3. Press the Windows key and enter cmd + Enter. A window will pop up within which you can type.

  4. Type C:\Python\bin\python C:\myproject\convert.py C:\myproject and press enter.

Hello Mario, thanks a lot for the info, I still have some difficulties to do it. I think a video will clear up what I'm doing wrong so you can help me easily.

I leave you the command I wrote:
C:\ Users\richa\AppData\Local\Programs\Python\Python311\bin\python C:\ GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine\convert.py C:\ GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine

Sorry that it is so complicated! You a space character after each C:\ in the command you are pasting from Word into the terminal. Remove the space characters and it should work.

Mario wrote

Sorry that it is so complicated! You a space character after each C:\ in the command you are pasting from Word into the terminal. Remove the space characters and it should work.

I still have the same issue Imade you a notepad with all the locations. I'm not sure if I have written well the python location from

C:\Python\bin\python

to

C:\Users\richa\AppData\Local\Programs\Python\Python311\bin\python

because I don't know if I have to write it like this

C:\Users\richa\AppData\Local\Programs\Python\Python311\bin\python

or like this

C:\Users\richa\AppData\Local\Programs\Python\Python311\python.exe\bin\python

Here you have all the info:

*** phyton.exe location***

C:\Users\richa\AppData\Local\Programs\Python\Python311\python.exe

*** convert.py location ***

C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine

*** original line***

C:\Python\bin\python C:\myproject\convert.py C:\myproject

*** line modified ***

C:\Users\richa\AppData\Local\Programs\Python\Python311\bin\python C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine\convert.py C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine

Result:

Python uses backslashes for escaping, while Windows uses them for paths (which was a terrible idea, thanks Microsoft). Thankfully Windows can use forward slashes (almost) anywhere backslashes would be used. Try this:

C:/Users/richa/AppData/Local/Programs/Python/Python311/bin/python C:/GODOT/TUTORIAL_FIGHTING_GAME_TO_TRY/TUTORIAL_FIGHTING_GAME/Spine/convert.py C:/GODOT/TUTORIAL_FIGHTING_GAME_TO_TRY/TUTORIAL_FIGHTING_GAME/Spine

Edit: Wait, you ran Python, then you pasted in the command. That is wrong. Run the command from the Windows command prompt.

Nate wrote

Python uses backslashes for escaping, while Windows uses them for paths (which was a terrible idea, thanks Microsoft). Thankfully Windows can use forward slashes (almost) anywhere backslashes would be used. Try this:

C:/Users/richa/AppData/Local/Programs/Python/Python311/bin/python C:/GODOT/TUTORIAL_FIGHTING_GAME_TO_TRY/TUTORIAL_FIGHTING_GAME/Spine/convert.py C:/GODOT/TUTORIAL_FIGHTING_GAME_TO_TRY/TUTORIAL_FIGHTING_GAME/Spine

Edit: Wait, you ran Python, then you pasted in the command. That is wrong. Run the command from the Windows command prompt.

I tried different ways, and it's telling me that the route specified is not valid

Do you mind to send me a picture of how to do it? At this point I don't know what I'm doing wrong and I think an example could help me with that.

You're using the command prompt now, so that is good. I can't really send you a picture because you have the files in different places on your computer.

The command you are entering is supposed to run Python, giving Python two paths (the convert.py file and the Godot project folder). The command fails because the path to Python is wrong.

Open file explorer. In the address bar, enter your path to the folder containing Python:

C:/Users/richa/AppData/Local/Programs/Python/Python311/bin

That should take you to a folder containing python.exe, but I'm guessing Windows won't be able to find it. You need to know where you have put the Python files. Once you do, enter the path to python.exe in the command window (don't worry about convert.py or the Godot project paths). Once that works (you can run Python in the command window), close it, open a new command window, and run Python with the convert.py and Godot project paths.

Imagine I opened a command prompt and typed C:\something\blah\python.exe. It wouldn't work at all, because that file doesn't exist on my computer. That is where you have gotten stuck. You need to enter a valid path to python.exe where Python is installed. If you can't find it, maybe reinstall Python and pay attention to the path where it is installed.

You don't need to worry about changing the directory because you are using the absolute paths to Python, convert.py, and the Godot project. Absolute paths start with eg C:\ and give the exact location, regardless of the current directory.

Nate wrote

You're using the command prompt now, so that is good. I can't really send you a picture because you have the files in different places on your computer.

The command you are entering is supposed to run Python, giving Python two paths (the convert.py file and the Godot project folder). The command fails because the path to Python is wrong.

Open file explorer. In the address bar, enter your path to the folder containing Python:

C:/Users/richa/AppData/Local/Programs/Python/Python311/bin

That should take you to a folder containing python.exe, but I'm guessing Windows won't be able to find it. You need to know where you have put the Python files. Once you do, enter the path to python.exe in the command window (don't worry about convert.py or the Godot project paths). Once that works (you can run Python in the command window), close it, open a new command window, and run Python with the convert.py and Godot project paths.

Imagine I opened a command prompt and typed C:\something\blah\python.exe. It wouldn't work at all, because that file doesn't exist on my computer. That is where you have gotten stuck. You need to enter a valid path to python.exe where Python is installed. If you can't find it, maybe reinstall Python and pay attention to the path where it is installed.

You don't need to worry about changing the directory because you are using the absolute paths to Python, convert.py, and the Godot project. Absolute paths start with eg C:\ and give the exact location, regardless of the current directory.

Thanks Nate! Now I understand exactly what I had to do. I watched some tutorial about how to execute python in cmd but I have this message and don't know how to write the command properly.


CMD CODE

C:\Users\richa>cd C:\Users\richa\AppData\Local\Programs\Python\Python311
C:\Users\richa\AppData\Local\Programs\Python\Python311>python "C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine\convert.py"

Please provide the path to your Godot project, e.g. python convert.py path/to/my/project.

convert.py path in windows

C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine

I tried different ways to write the "path/to/my/project" path but nothing seems to work fine.For example:

python convert.py "C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine"
python convert.py C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine
python convert.py c:/GODOT/TUTORIAL_FIGHTING_GAME_TO_TRY/TUTORIAL_FIGHTING_GAME/Spine
python convert.py C:/GODOT/TUTORIAL_FIGHTING_GAME_TO_TRY/TUTORIAL_FIGHTING_GAME/Spine

And it always gives me the same error: "python.exe: can't open file 'C:\Users\richa\AppData\Local\Programs\Python\Python311\convert.py': [Errno 2] No such file or directory"

You are close! You are running the right commands, but you are only specifying the path to Python and the convert.py parameter. That starts Python and runs the convert.py script, but the script expects another parameter, which is the path to your Godot project. Run this command (copy and paste it into the command prompt then press enter):

C:\Users\richa\AppData\Local\Programs\Python\Python311\python C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine\convert.py C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine
Nate wrote

You are close! You are running the right commands, but you are only specifying the path to Python and the convert.py parameter. That starts Python and runs the convert.py script, but the script expects another parameter, which is the path to your Godot project. Run this command (copy and paste it into the command prompt then press enter):

C:\Users\richa\AppData\Local\Programs\Python\Python311\python C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine\convert.py C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine

It was close! But the process gives an error: saying something like this:

PermissionError: [WinError 32] The process does not have access to the file because it is in use by another process:

'C:\\GODOT\\TUTORIAL_FIGHTING_GAME_TO_TRY\\TUTORIAL_FIGHTING_GAME\\Spine\\Ebrius.json' -> 'C:\\GODOT\\TUTORIAL_FIGHTING_GAME_TO_TRY\\TUTORIAL_FIGHTING_GAME\\Spine\\Ebrius.spine-json'

I tried to open the CMD in administrator mode, but it trows the same error. It seems that in the process of accessing the files they are overlapping, any ideas?

If the process has worked, I should have seen the name of the JSON files change in the explorer, right?

If you have your Godot project open in the Godot editor, the editor will be blocking any other program from accessing the files. Close the Godot editor while running the Python script.

Mario wrote

If you have your Godot project open in the Godot editor, the editor will be blocking any other program from accessing the files. Close the Godot editor while running the Python script.

Hello Mario Godot wasn't open when I run the script, maybe I'm doing the process wrong let me explain what I'm doing:

1) In order to transform the files from JSON to JSON-SPINE, I erase all the previous JSON, ATLAS except the .TRES files from my project without open it in Godot:

*** INITIAL CONFIGURATION ***

2) Then I export the files in Spine to the Spine folder of the project:

*** EXPORTING FROM SPINE TO THE SPINE FOLDER***

*** GODOT PROJECT SPINE FOLDER AFTER EXPORTING ***

3) After all the files have been exported I have the JSON files ready to be changed.So I run the cmd in administrator mode and write the command line.

*** RUNNING THE COMMAND AND GETTING THE ERROR****

C:\Users\richa\AppData\Local\Programs\Python\Python311\python C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine\convert.py C:\GODOT\TUTORIAL_FIGHTING_GAME_TO_TRY\TUTORIAL_FIGHTING_GAME\Spine

4) Then is when I get the error message:
PermissionError: [WinError 32] The process does not have access to the file because it is in use by another process:

'C:\\GODOT\\TUTORIAL_FIGHTING_GAME_TO_TRY\\TUTORIAL_FIGHTING_GAME\\Spine\\Ebrius.json' -> 'C:\\GODOT\\TUTORIAL_FIGHTING_GAME_TO_TRY\\TUTORIAL_FIGHTING_GAME\\Spine\\Ebrius.spine-json'

Maybe in this way will be easier to see where I'm mistaken. I haven't open Godot in the process, and Spine is also close.

That's really puzzling then. Could you try this tool?
https://lockhunter.com/

Install the tool. Then run the command and wait until it fails. Then right click the Ebrius.json file in the file explorer and select What's locking the file? from the context menu. It should then show you a list of processes that are locking the file, preventing the Python script from renaming it.

Mario wrote

That's really puzzling then. Could you try this tool?
https://lockhunter.com/

Install the tool. Then run the command and wait until it fails. Then right click the Ebrius.json file in the file explorer and select What's locking the file? from the context menu. It should then show you a list of processes that are locking the file, preventing the Python script from renaming it.

I used the tool and Apparently there's nothing blocking it. I searched for the error and found this page, maybe it could help.

https://stackoverflow.com/questions/27215462/permissionerror-winerror-32-the-process-cannot-access-the-file-because-it-is

I tried as they said to exit from Dropbox and Google Drive, but the permission error remains.

It might be something strange with permissions for your Godot project files. Try this: click the Windows button in the lower left of the screen, type "command" so you see "Command Prompt", right click "Command Prompt" and choose "Run as Administrator". That opens Command Prompt and then try to run the script again.

If that doesn't work, you can go to your Godot project folder, right click, Properties, Security tab, advanced, check "Replace all child object permissions...", then click "Add", "Select a principal", type your Windows user name, click Check Names, then OK, check "Full Control", OK again, OK one more time, I lied there's another OK


done! That will change all the permissions of your Godot project files so your Windows user has full control. Whew.

Nate wrote

It might be something strange with permissions for your Godot project files. Try this: click the Windows button in the lower left of the screen, type "command" so you see "Command Prompt", right click "Command Prompt" and choose "Run as Administrator". That opens Command Prompt and then try to run the script again.

If that doesn't work, you can go to your Godot project folder, right click, Properties, Security tab, advanced, check "Replace all child object permissions...", then click "Add", "Select a principal", type your Windows user name, click Check Names, then OK, check "Full Control", OK again, OK one more time, I lied there's another OK


done! That will change all the permissions of your Godot project files so your Windows user has full control. Whew.

Many thanks to you and Mario for all your help, I have done the 2 options with the same result. As far as I read here:

https://stackoverflow.com/questions/27215462/permissionerror-winerror-32-the-process-cannot-access-the-file-because-it-is

It could because of python-windows issue.

But I think I'd better stick with the first method: replace it manually. For the project I'm doing, there aren't that many Spine nodes that need to be replaced, so it's not a tedious job. It is also an option until Godot 4 arrives, which will be soon. Once again, thank you very much for your help. I will make a video tutorial with my experience with the first method to help people who want to update the runtime.

Cheers.

Mario wrote

I've just updated the convert.py script in the 4.1 and 4.2-beta branches to fix this issue. Please give that a try before you go manually fix up your project:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-godot/convert.py

And the sweet message came out... :grinfake :grinfake :grinfake

Thanks now it works flawlessly! :cooldoge: :cooldoge:


maranpis wrote
Mario wrote

I've just updated the convert.py script in the 4.1 and 4.2-beta branches to fix this issue. Please give that a try before you go manually fix up your project:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-godot/convert.py

And the sweet message came out... :grinfake :grinfake :grinfake

Thanks now it works flawlessly! :cooldoge: :cooldoge:

Hello guys, Here I leave a resume of the 2 methods for updating JSON files in the new Spine Godot Runtime. Thanks to Nate and Mario for their help.

3 months later
Nate unstickied the discussion .