- #1
Eclair_de_XII
- 1,083
- 91
- TL;DR Summary
- I have a bunch of figures created, and I wish to save them all into one folder in order to save myself the trouble of showing the figures on my browser, and then downloading each and every one of them.
To this end, I am following the instructions described here on how to do so:
https://plotly.com/python/static-image-export/
I am not skilled in programming, so I do not know why my command lines do not perform the intended function and return, instead, the error messages to be found below.
Python:
from plotly import graph_objects as go
import plotly.io as pio
arabella=go.Figure()
arabella.add_trace(go.Scatter(
x=[0,0,1,1,0],
y=[0,1,1,0,0],
text=["Origin","$e_2$","","$e_1$"],
textposition=["bottom left","top left","top center","bottom right"],
mode='text+lines+markers'
))
orca="C:/Users/Eclair/.plotly/.orca"
direc="C:/Users/Eclair/Documents/2 LaTeX/active/"
pio.orca.config.executable=orca
pio.orca.config.save()
arabella.write_image(direc,"arabella.png")
I executed this code, and the following error message was returned to me:
Code:
C:\Users\Eclair\AppData\Local\Programs\Python\Python38-32\python.exe C:/Users/Eclair/.PyCharmCE2019.3/config/scratches/scratch_1.py
Traceback (most recent call last):
File "C:/Users/Eclair/.PyCharmCE2019.3/config/scratches/scratch_1.py", line 20, in <module>
arabella.write_image(direc,"arabella.png")
File "C:\Users\Eclair\AppData\Roaming\Python\Python38\site-packages\plotly\basedatatypes.py", line 2824, in write_image
return pio.write_image(self, *args, **kwargs)
File "C:\Users\Eclair\AppData\Roaming\Python\Python38\site-packages\plotly\io\_orca.py", line 1766, in write_image
img_data = to_image(
File "C:\Users\Eclair\AppData\Roaming\Python\Python38\site-packages\plotly\io\_orca.py", line 1532, in to_image
ensure_server()
File "C:\Users\Eclair\AppData\Roaming\Python\Python38\site-packages\plotly\io\_orca.py", line 1390, in ensure_server
validate_executable()
File "C:\Users\Eclair\AppData\Roaming\Python\Python38\site-packages\plotly\io\_orca.py", line 1144, in validate_executable
p = subprocess.Popen(
File "C:\Users\Eclair\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Eclair\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application
Process finished with exit code 1
If it matters, I am using the PyCharm interpreter. I did a bunch of searches on this issue, using the words on the last line as my search criteria. The answers ranged from what I presume to be bad directories, the interpreter's inability to find the executable orca file, and some other stuff that I am too code-illiterate to understand. I tried doing the thing requested by the error message and using the plotly.io.config.executable attribute in order to set the directory for the orca executable, which I assumed was the file referred to in this code:
Python:
import plotly.io as pio
print(pio.orca.config)
Code:
C:\Users\Eclair\AppData\Local\Programs\Python\Python38-32\python.exe C:/Users/Eclair/.PyCharmCE2019.3/config/scratches/scratch_1.py
orca configuration
------------------
server_url: None
executable: C:/Users/Eclair/.plotly/.orca
port: None
timeout: None
default_width: None
default_height: None
default_scale: 1
default_format: png
mathjax: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js
topojson: None
mapbox_access_token: None
use_xvfb: auto
constants
---------
plotlyjs: C:\Users\Eclair\AppData\Roaming\Python\Python38\site-packages\plotly\package_data\plotly.min.js
config_file: C:\Users\Eclair\.plotly\.orca