Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit b4843a5

Browse files
author
Piotr Plonski
committed
set tmp paths os independent
1 parent 59d1d48 commit b4843a5

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

mljar/client/dataset.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66
import time
77
import copy
8+
import tempfile
89
from zipfile import ZipFile, ZIP_DEFLATED
910
from os.path import basename
1011
from base import MljarHttpClient
@@ -163,7 +164,8 @@ def add_new_dataset(self, data, y, title_prefix = 'dataset-', dataset_title = No
163164
title = title_prefix + str(uuid.uuid4())[:4] # set some random name
164165
else:
165166
title = dataset_title
166-
file_path = '/tmp/dataset-'+ str(uuid.uuid4())[:8]+'.csv'
167+
168+
file_path = os.path.join(tempfile.gettempdir(), 'dataset-'+ str(uuid.uuid4())[:8]+'.csv')
167169

168170
logger.info('Compress data before export')
169171
prediction_only = y is None

mljar/client/prediction_download.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import uuid
3+
import tempfile
34
import pandas as pd
45
from base import MljarHttpClient
56
from ..exceptions import PredictionDownloadException
@@ -18,7 +19,7 @@ def download(self, prediction_hid):
1819
response = self.request("POST", self.url, data = {"prediction_id": prediction_hid}, parse_json=False)
1920
pred = None
2021
try:
21-
tmp_file = '/tmp/mljar_prediction_' + str(uuid.uuid4()) + '.csv'
22+
tmp_file = os.path.join(tempfile.gettempdir(), 'mljar_prediction_' + str(uuid.uuid4()) + '.csv')
2223
with open(tmp_file, 'wb') as f:
2324
for chunk in response.iter_content(chunk_size=1024):
2425
if chunk: # filter out keep-alive new chunks

0 commit comments

Comments
 (0)