Skip to content

Commit

Permalink
fix export
Browse files Browse the repository at this point in the history
Signed-off-by: Nikhil Dhandre <[email protected]>
  • Loading branch information
digitronik committed Apr 13, 2019
1 parent c26fbfd commit 5b05a61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions gribreader/gribreader-gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ def export_data():
file_name = asksaveasfilename(
filetypes=[("CSV", ".csv"), ("all files", ".*")], defaultextension=".csv"
)
import ipdb

ipdb.set_trace()
grad.export_csv(path=file_name)
try:
grad.export_csv(path=file_name)
f3_notification.config(text="Successfully exported", fg="green")
except Exception as e:
f3_notification.config(text="Fail to export", fg="red")


# Frame Management
Expand Down Expand Up @@ -214,6 +215,7 @@ def export_data():

Button(f3, text="Export", padx=58, pady=10, fg="red", command=export_data).pack(pady=10, fill=X)

f3_notification = Label(f3, text=" ")

# UP gui
poll_listbox()
Expand Down
3 changes: 2 additions & 1 deletion gribreader/gribreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def export_csv(self, path):
:param path: Path to save csv file.
:type path: str
"""
with open("path", "wb") as csvfile:
with open(path, "wb") as csvfile:
dw = csv.writer(csvfile, delimiter=",")
lon_csv = ["Latitude /Longitude"] + self.longitudes
dw.writerow(lon_csv)
Expand All @@ -257,3 +257,4 @@ def export_csv(self, path):
else:
row.append("--")
dw.writerow(row)
return True

0 comments on commit 5b05a61

Please sign in to comment.