Spaces:
Sleeping
Sleeping
fix FileNotFoundError
Browse filesFileNotFoundError: [Errno 2] No such file or directory: '.doc/1174081514523066368, 2023-11-14 20:20:00+08:00, 2023-11-15 14:59:00+08:00.png'
- draw_db.py +7 -2
draw_db.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import math
|
|
|
2 |
|
3 |
import dateutil.tz
|
4 |
import matplotlib.pyplot as plt
|
@@ -52,12 +53,16 @@ def draw_lists(title='', date_list=None, **kv_list):
|
|
52 |
plt.gcf().autofmt_xdate()
|
53 |
axs[0].set_title(title)
|
54 |
|
|
|
|
|
|
|
|
|
55 |
if DEBUG:
|
56 |
# plt.show()
|
57 |
-
file_uri = '
|
58 |
fig.savefig(file_uri)
|
59 |
else:
|
60 |
-
file_uri = '
|
61 |
fig.savefig(file_uri)
|
62 |
|
63 |
return fig
|
|
|
1 |
import math
|
2 |
+
import os
|
3 |
|
4 |
import dateutil.tz
|
5 |
import matplotlib.pyplot as plt
|
|
|
53 |
plt.gcf().autofmt_xdate()
|
54 |
axs[0].set_title(title)
|
55 |
|
56 |
+
tmp_dir = 'tmp'
|
57 |
+
if not os.path.exists(tmp_dir):
|
58 |
+
os.mkdir(tmp_dir)
|
59 |
+
|
60 |
if DEBUG:
|
61 |
# plt.show()
|
62 |
+
file_uri = tmp_dir + '/' + title + '.png'
|
63 |
fig.savefig(file_uri)
|
64 |
else:
|
65 |
+
file_uri = tmp_dir + '/' + title + '.png'
|
66 |
fig.savefig(file_uri)
|
67 |
|
68 |
return fig
|