Export to Python file from Notebook

1628
6
07-16-2023 07:58 AM
JohnMorgan
Occasional Contributor

Hello, 

I am running ArcGIS Pro 3.1.2 and working in a Python Notebook. I have several working cells and am trying to export them to a Python script (Export > Export to Python file). However, when I do this, I get the error "Export failed" with no further info. 

Any advice would be appreciated.

Derek

 

Tags (3)
6 Replies
David_McRitchie
Esri Contributor

Hey Derek,

Would it be possible to get a copy of your notebook so that it can be tested on a different environment.

It would also be worth copying the cells into a new .py file and checking if this works fine.

 

Many thanks,

David

Esri UK -Technical Support Analyst
0 Kudos
MicZatorsky_AEC
Occasional Contributor III

My guess, there are spaces in the filename and/or file path.  Test exporting to "c:\temp\mycode.py".

0 Kudos
JohnMorgan
Occasional Contributor

Hello, 

I don't have a space in the file name, but I did find a workaround for now. It would be nice to sort out why it isn't working, but perhaps it's just something w/ my installation.  David, for an attached notebook, but it won't let me attach that type of file to this message board.

0 Kudos
David_McRitchie
Esri Contributor

Ah would it be possible to set up a shared folder for the notebook? If not then please message me your email and I can set one up.

David

Esri UK -Technical Support Analyst
0 Kudos
HeeJinYang
New Contributor

I have the same problem. 

Would you let me know how you solved the problem?

0 Kudos
JohnMorgan
Occasional Contributor

It has been a while since I looked at this. But, I do recall the workaround of using the command line of nbconvert as described here. https://stackoverflow.com/questions/17077494/how-do-i-convert-a-ipython-notebook-into-a-python-file-...

>jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb

Ideally, it would just work straight out of ArcGIS though.