Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
TOUZE Francois
PSPA
Commits
993f9b5d
Commit
993f9b5d
authored
Dec 18, 2019
by
TOUZE Francois
Browse files
add controller file for Linux
parent
d1fddfe0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
controller/pspa-Linux.py
controller/pspa-Linux.py
+39
-0
No files found.
controller/pspa-Linux.py
0 → 100644
View file @
993f9b5d
#!/bin/env python3
from
flask
import
Flask
,
render_template
,
jsonify
from
flask
import
request
import
os
import
json
import
urllib.parse
from
cython
-
cpp
import
pspaclass
from
cython
-
cpp
import
pspaplots
from
flask_cors
import
CORS
app
=
Flask
(
__name__
,
template_folder
=
'.'
)
cors
=
CORS
(
app
,
resources
=
{
r
"/api/*"
:
{
"origins"
:
"*"
}})
curdir
=
os
.
getcwd
()
print
(
"current directory => "
,
curdir
)
pkgRoot
=
curdir
.
split
(
'pspa'
)
print
(
"root directory => "
,
pkgRoot
[
0
])
upath
=
os
.
path
.
join
(
pkgRoot
[
0
],
'workZone/'
)
wpath
=
os
.
path
.
join
(
pkgRoot
[
0
],
'pspa/softwares/'
)
@
app
.
route
(
'/api/importe'
,
methods
=
[
'GET'
,
'POST'
])
def
importe
():
u_bytes
=
str
.
encode
(
upath
)
w_bytes
=
str
.
encode
(
wpath
)
ptr
=
pspaclass
.
PyPspaClass
(
u_bytes
,
w_bytes
)
x
=
request
.
json
print
(
"/api/importe => "
,
x
[
'fileName'
]
)
x_bytes
=
str
.
encode
(
x
[
'fileName'
]
)
s
=
ptr
.
read
(
x_bytes
).
decode
(
'utf-8'
)
response
=
{
'import'
:
s
}
return
jsonify
(
response
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment