Skip to content

Conversation

@Shine226
Copy link
Collaborator

No description provided.

@Shine226 Shine226 requested a review from brownsarahm May 11, 2020 20:20
@brownsarahm brownsarahm marked this pull request as draft May 11, 2020 20:25
Comment on lines +172 to +189
elif type(data) == list and meta ==None and results ==None:
# if files are uploaded from wiggum-app
filename = ''
for file in data:
filename = file.filename
if ('/' in filename):
# if file name contains '/', Wiggum runs in Windows system
# remove the directory and only use the file name
filename = filename.split('/')[1]

if filename == data_csv:
data = file
elif filename == meta_csv:
meta = file
elif filename == result_csv:
results = file
elif filename == trend_json:
trends = file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there no way to do this on the app side? like have the upload step put the files in a temp directory and then pass that to the initialize function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will be more complicated.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I think better and possibly more on the path to allowing the user to download and save their results where they would like.

with open(trends, 'r') as tjson:
trend_content = json.load(tjson)
elif type(trends) is FileStorage:
trend_content = json.load(trends)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you not use the safe with open format for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the trends are already a FileStorage type, can't use open function.

DEBUG=True
SECRET_KEY="4zNNYuWQjNCHoCFrhEKqUDLB1Z5xGl2W/Yliy63tD8po9qOQ0YjPum5OaSDnPvNvB1eLzany73EHJfFlYEov1g=="
SERVER_NAME="127.0.0.1:5000"
SAVE_FOLDER="data/" No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this / resolve correctly on windows and mac?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that is moving the hard code directory from controller.py to config.py.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then #95 is not closed, becase you are making the config as a place the user should do some setup, so:

  1. make it a template and provide instructions for the user
  2. make sure that where you use this you use something that safely puts the / or \ as appropriate per os (eg os.path.join

@brownsarahm brownsarahm changed the base branch from master to main August 6, 2020 19:42
@brownsarahm
Copy link
Collaborator

@Shine226 you should resovle the conflicts in this branch and get it ready to merge

@Shine226
Copy link
Collaborator Author

Shine226 commented Aug 6, 2020

@brownsarahm I don't remember what is the conflicts in this branch.

@Shine226 Shine226 marked this pull request as ready for review September 9, 2020 20:25
brownsarahm
brownsarahm previously approved these changes Sep 10, 2020
@brownsarahm brownsarahm dismissed their stale review September 10, 2020 13:44

found error

@brownsarahm
Copy link
Collaborator

When I click the save button I get the following traceback on the iristest data with pearson correlation and linear regression.

Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/anaconda3/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/anaconda3/lib/python3.8/site-packages/wiggum_app/controller.py", line 208, in main
    models.compress_files(directory)
  File "/opt/anaconda3/lib/python3.8/site-packages/wiggum_app/models.py", line 319, in compress_files
    zipf = zipfile.ZipFile(file_path, 'w', zipfile.ZIP_DEFLATED)
  File "/opt/anaconda3/lib/python3.8/zipfile.py", line 1250, in __init__
    self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: 'wiggum_app/download/data.zip

and then the same as a browser side error on clicking download.

Also minor formatting issue, when the window is small,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants