JustinGOSSES / wellio.js

JavaScript for converting well-log standard .las file format to json format
https://justingosses.github.io/wellio.js/
MIT License
34 stars 5 forks source link

BUG: fs for file uploading works with node.js but not in jupyter notebook #40

Closed JustinGOSSES closed 4 years ago

JustinGOSSES commented 4 years ago

BUG: fs for file uploading works with node.js but not in jupyter notebook

Probably need to have the file upload function figure out which type of environment it is in and then use the appropriate file upload method. This has likely been figured out before, so might pull in a library for it or use an example?

This was mentioned in issue #7 https://github.com/JustinGOSSES/wellio.js/issues/7#issuecomment-586723761

and relates to issue #39

JustinGOSSES commented 4 years ago

Apparently this can also cause a problem when wellio.js is used by wellioviz and pulled into an Angular bundle. Really need to find an alternative to fs that is more flexible as fs only works on server side operations and some front-ends when used directly.....not Jupyter notebooks or when packaged up in Angular.

dcslagel commented 4 years ago

@JustinGOSSES,

I'm interested to work on this. Is there a test that can be run to reproduce the current fs failure in a Jupyter notebook or Angular bundle? Or optionally, the steps to reproduce the failure?

Thanks,

DC

dcslagel commented 4 years ago

I'm working with "wellio.js/notebooks/wellio.js and lasio test.ipynb" on a local jupyter server.

Currently at "wellio.read_json('data.json')" there is a Thrown message of { Error: ENOENT: no such file or directory, open 'data.json'\n"..}". That looks to be a path problem, so checking that first but expecting to find a 'fs()' issue after I know the code is finding the data.json file.

Sidenote: Sometimes I'm getting this error: UsageError: Cell magic %%node not found. Killing the jupyter server seems to 'fix' it. Do you have any suggestions to prevent this issue?

Thanks, DC

dcslagel commented 4 years ago

See current potential solution and discussion for this issue is at #48.

DC

JustinGOSSES commented 4 years ago

just getting back to this..sorry for delay.

%%node in a python notebook has always been somewhat flaky for me. Part of the reason is error are frequently JavaScript when I expect them to be python. Hence, I forget to look in inspector and expect them to be output below the cell.

I've seen something similar to 'data.json'\n"..}". when there is a newline from javascript copy and paste that is invisible but there...hence the \n that suddenly appears in your error.

dcslagel commented 4 years ago

@JustinGOSSES,

Just checking with #48 merging what needs to be worked out to resolve this issue?

Thanks, DC

JustinGOSSES commented 4 years ago

Good reminder.

I'm not sure. I'll want to check it in both Jupyter & when wellioviz gets used in angular as problems were seen in both cases. I'll try to tackle this sometime this week.

dcslagel commented 4 years ago

Okay, That sounds good.

Thanks!, DC