Skip to content

Debug corrected#37

Closed
parteekcoder wants to merge 6 commits intoControlCore-Project:devfrom
parteekcoder:debug_corrected
Closed

Debug corrected#37
parteekcoder wants to merge 6 commits intoControlCore-Project:devfrom
parteekcoder:debug_corrected

Conversation

@parteekcoder
Copy link
Contributor

ControlCore-Project/concore-editor#87

Applied check on debug method before executing

parteekcoder and others added 6 commits February 18, 2023 15:50
issue #31 solved ,

We have to enable shell=True

Also There is One more bug that is if os.path.exists(dir_path) it will not enter if block and resp will not be defined and it also produces
@parteekcoder
Copy link
Contributor Author

hey @pradeeban i think all these changes can be merged together

@parteekcoder parteekcoder changed the base branch from dev to main February 19, 2023 16:47
@parteekcoder parteekcoder changed the base branch from main to dev February 19, 2023 16:48
@pradeeban pradeeban mentioned this pull request Feb 20, 2023
@pradeeban
Copy link
Member

This PR fixes the execution for Windows, but breaks the execution on MacOS (and likely on Linux systems too).

test_xyz/sample: makestudy: command not found

While I appreciate the attempt at fixing this for Windows, we should note that at this point we have more users who use Linux and MacOS than Windows. Therefore, please avoid PRs that will favor Windows over Linux.

We need a proper fix to handle all the OS (Linux, MacOS, and Windows). But that is too much of an effort.

We can continue further discussion on Windows support at #41.

@pradeeban pradeeban closed this Feb 20, 2023
@parteekcoder
Copy link
Contributor Author

This PR fixes the execution for Windows, but breaks the execution on MacOS (and likely on Linux systems too).

test_xyz/sample: makestudy: command not found

While I appreciate the attempt at fixing this for Windows, we should note that at this point we have more users who use Linux and MacOS than Windows. Therefore, please avoid PRs that will favor Windows over Linux.

We need a proper fix to handle all the OS (Linux, MacOS, and Windows). But that is too much of an effort.

We can continue further discussion on Windows support at #41.

I have also tested on MAC OS and it was running fine , can you please tell me how you get this error means what steps are performed

@pradeeban
Copy link
Member

$ cd sample-parteek/
Pradeebans-MBP:sample-parteek pradeeban$ ./build
Pradeebans-MBP:sample-parteek pradeeban$
Pradeebans-MBP:sample-parteek pradeeban$
Pradeebans-MBP:sample-parteek pradeeban$
Pradeebans-MBP:sample-parteek pradeeban$ cd
Pradeebans-MBP:~ pradeeban$ cd parteek/
Pradeebans-MBP:parteek pradeeban$ cd fri/
Pradeebans-MBP:fri pradeeban$ cd server/
Pradeebans-MBP:server pradeeban$ git checkout debug_corrected
Already on 'debug_corrected'
Your branch is up to date with 'origin/debug_corrected'.
Pradeebans-MBP:server pradeeban$ python3 main.py

  • Serving Flask app 'main'
  • Debug mode: off
    WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
  • Running on all addresses (0.0.0.0)
  • Running on http://127.0.0.1:5000
  • Running on http://192.168.1.236:5000
    Press CTRL+C to quit
    127.0.0.1 - - [19/Feb/2023 22:56:16] "POST /upload/test?apikey=xyz HTTP/1.1" 201 -
    test_xyz/sample: makestudy: command not found
    [2023-02-19 22:56:18,363] ERROR in app: Exception on /build/test [POST]
    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
    File "main.py", line 83, in build
    call(["build"],shell=True, cwd=dir_path)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in init
    restore_signals, start_new_session)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/Users/pradeeban/parteek/sample': '/Users/pradeeban/parteek/sample'
    127.0.0.1 - - [19/Feb/2023 22:56:18] "POST /build/test?fetch=sample&apikey=xyz HTTP/1.1" 500 -
    /Users/pradeeban/parteek/sample
    [2023-02-19 22:56:41,037] ERROR in app: Exception on /run/sample [POST]
    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
    File "main.py", line 113, in run
    proc = call(["run"],shell=True, cwd=dir_path)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in init
    restore_signals, start_new_session)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/Users/pradeeban/parteek/sample': '/Users/pradeeban/parteek/sample'
    127.0.0.1 - - [19/Feb/2023 22:56:41] "POST /run/sample HTTP/1.1" 500 -
    [2023-02-19 22:56:43,046] ERROR in app: Exception on /stop/sample [POST]
    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
    File "main.py", line 128, in stop
    proc = call(["stop"],shell=True, cwd=dir_path)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in init
    restore_signals, start_new_session)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/Users/pradeeban/parteek/sample': '/Users/pradeeban/parteek/sample'
    127.0.0.1 - - [19/Feb/2023 22:56:43] "POST /stop/sample HTTP/1.1" 500 -
    [2023-02-19 22:56:45,057] ERROR in app: Exception on /getFilesList/sample [POST]
    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
    File "main.py", line 191, in getFilesList
    res = os.listdir(dir_path)
    FileNotFoundError: [Errno 2] No such file or directory: '/Users/pradeeban/parteek/sample/cu'
    127.0.0.1 - - [19/Feb/2023 22:56:45] "POST /getFilesList/sample?fetch=cu HTTP/1.1" 500 -
    [2023-02-19 22:56:45,062] ERROR in app: Exception on /getFilesList/sample [POST]
    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
    File "main.py", line 191, in getFilesList
    res = os.listdir(dir_path)
    FileNotFoundError: [Errno 2] No such file or directory: '/Users/pradeeban/parteek/sample/pym'
    127.0.0.1 - - [19/Feb/2023 22:56:45] "POST /getFilesList/sample?fetch=pym HTTP/1.1" 500 -
    127.0.0.1 - - [19/Feb/2023 22:56:50] "GET /download/sample?fetchDir=cu&fetch=u HTTP/1.1" 400 -

Pradeebans-MBP:~ pradeeban$ cd parteek/fri/
Pradeebans-MBP:fri pradeeban$ ls
DOCKER-README.md Dockerfile README.md example.py requirements.txt server service_config.sh test.py
Pradeebans-MBP:fri pradeeban$ python3 test.py
{"message":"Files successfully uploaded"}

<!doctype html>

<title>500 Internal Server Error</title>

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

methods - 1 for debug, 0 for run :0
<!doctype html>

<title>500 Internal Server Error</title>

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

<!doctype html>

<title>500 Internal Server Error</title>

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

<!doctype html>

<title>500 Internal Server Error</title>

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

<!doctype html>

<title>500 Internal Server Error</title>

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Traceback (most recent call last):
File "test.py", line 102, in
download("sample", "cu", "u")
File "test.py", line 68, in download
urllib.request.urlretrieve(url, fileName)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open
response = meth(req, response)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: BAD REQUEST

@parteekcoder
Copy link
Contributor Author

@pradeeban can you please share specification of your system

@pradeeban
Copy link
Member

@Rahuljagwani, when you have time, can you please test the above PR? It fails for me.

@Rahuljagwani
Copy link
Contributor

@Rahuljagwani, when you have time, can you please test the above PR? It fails for me.

Sorry for late reply, sure will test this.

@parteekcoder
Copy link
Contributor Author

@Rahuljagwani, when you have time, can you please test the above PR? It fails for me.

Sorry for late reply, sure will test this.

@Rahuljagwani thanks for testing , plz tell me what's the error as I also ran it on macOS

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