Comments (4)
PermissionError: [Errno 13] Permission denied: './private.py'
that's as far as i'm gonna go error wise as there is no context other than tht
does not work with your example on kali or ubuntu
from flask-shell2http.
ok so a self solve
# web imports
from flask import Flask
from flask_executor import Executor
from flask_shell2http import Shell2HTTP
# Flask application instance
app = Flask(__name__)
# application factory
executor = Executor(app)
shell2http = Shell2HTTP(app, executor, base_url_prefix="/scripts/")
shell2http.register_command(endpoint="hacktheplanet", command_name="python3 ./fuxsocy.py")
# Application Runner
if __name__ == "__main__":
app.testing = True
c = app.test_client()
"""
The final executed command becomes:
```bash
$ ./fuxsocy.py
```
"""
uri = "/scripts/hacktheplanet"
resp1 = c.post(uri, json={"args": []}).get_json()
print(resp1)
# fetch result
result_url = resp1["result_url"]
resp2 = c.get(result_url).get_json()
print(resp2)
this is how your script should be
than the contents of the py like so
import os
import sys
print(2*2)
and return code proving the example is flat out not working
{"end_time":1635766722.6711774,"error":"","key":"5bb35ab3","process_time":0.012186288833618164,"report":"4\n","returncode":0,"start_time":1635766722.658991}
so the problem is you were passing a python script to bash with no Interpreter
from flask-shell2http.
Hey!
PermissionError: [Errno 13] Permission denied: './private.py'
The reason you are getting PermissionError
is because your user does not have the executable permission on the private.py
file. Assuming you are on a unix based system, you can simply run the command chmod u+x private.py
to solve this.
so the problem is you were passing a python script to bash with no Interpreter
If a python file includes the shebang statement (#!/usr/bin/env python3
) on the first line and has the executable flag (x
) set, then it's possible to run it by just invoking it with ./
instead of python3
.
Of course your solution is fine too and maybe even better for the sake of simplicity.
from flask-shell2http.
nope tht was not it i have no permission errors simply like i showed you above when calling python via bash it needs to be prefixed with python3 the permission error was due to not using python3 before the fuxsocy.py file go figure it works though
but u make a good point shhh dont tell anyone i forgot my shebangs plz
from flask-shell2http.
Related Issues (20)
- [test case] command that raises exception with returncode of -1
- Enable test cases for flask 2.0
- Better typing and mypy in testing
- No report exists for key... HOT 8
- Force Option and Result URL HOT 3
- Nested JSON HOT 2
- `wait` query param in `GET`
- `future.done()` and `callback_fn` race condition
- Fails if ran with multiple gunicorn workers HOT 1
- future_key already exists HOT 1
- Enable ci/tests for python 3.10
- Add some kind of basic auth HOT 2
- Possibility to interrupt command HOT 4
- use python format function HOT 2
- Cannot Import 'safe_join' from 'flask.helpers'
- A way to get binary output HOT 2
- Question HOT 1
- Seeing intermittent future_key errors HOT 3
- [New Feature] intercepting arguments before command execution
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-shell2http.