
Quote from lesanch on March 6, 2020, 1:19 amHi all,
I need to get the username from OS and store in a variable at the very first moment the app starts. But i can't find how to do it, javascript can do this ? i had read that from client side is impossible. Another way i figured was to create a python funtion executed from an form action and get the html response containing the username, but i can't find how to execute this without to press a form boton.
Regards,
Sam.
Hi all,
I need to get the username from OS and store in a variable at the very first moment the app starts. But i can't find how to do it, javascript can do this ? i had read that from client side is impossible. Another way i figured was to create a python funtion executed from an form action and get the html response containing the username, but i can't find how to execute this without to press a form boton.
Regards,
Sam.

Quote from luishp on March 6, 2020, 8:07 amHi @lesanch
You can use a hidden Form and then FormSubmit or ClickObject commands to send the form using code.
Another option is using FileToVar sending URL parameters to the Python script.
Regards.
Hi @lesanch
You can use a hidden Form and then FormSubmit or ClickObject commands to send the form using code.
Another option is using FileToVar sending URL parameters to the Python script.
Regards.

Quote from lesanch on March 6, 2020, 6:27 pmHi,
On page-enter i have:
FileToVar "http://localhost:8000/cgi-bin/modulos/get_user.py" [Data]
but nothing happens, i don't know if i'm missing something. The var DATA it's empty.
The .py contents is as simple as this:
import cgi, cgitb
import getpassprint ("Access-Control-Allow-Origin: *\r\n\r\n")
# Create instance of FieldStorage
form = cgi.FieldStorage()userso=(getpass.getuser())
print (userso)
Using form it's not working neither after set ACTION field with .py script.
Reading the http.server logs the execution is finish OK.
Regards,
Sam
Hi,
On page-enter i have:
FileToVar "http://localhost:8000/cgi-bin/modulos/get_user.py" [Data]
but nothing happens, i don't know if i'm missing something. The var DATA it's empty.
The .py contents is as simple as this:
import cgi, cgitb
import getpass
print ("Access-Control-Allow-Origin: *\r\n\r\n")
# Create instance of FieldStorage
form = cgi.FieldStorage()
userso=(getpass.getuser())
print (userso)
Using form it's not working neither after set ACTION field with .py script.
Reading the http.server logs the execution is finish OK.
Regards,
Sam

Quote from farhad2008 on March 6, 2020, 7:04 pm@lesanch
what is your webserver ?
what is your webserver ?

Quote from lesanch on March 6, 2020, 7:16 pma python integrated web server very tiny. but i installed yestarday LARAGON, so i going to test with that. The others .py scripts return ok, the only difference is that this script makes an print only, the others return values from funtions and then print.
Regards,
Sam
a python integrated web server very tiny. but i installed yestarday LARAGON, so i going to test with that. The others .py scripts return ok, the only difference is that this script makes an print only, the others return values from funtions and then print.
Regards,
Sam

Quote from lesanch on March 6, 2020, 8:55 pmThe [Returnstatus] of the execution is -1
>>>>> SetVar [ReturnStatus] [Status]
but i can't see the error, it's not Displayed.
>>>>> SetObjectHTML "Container1" "[Data]" -----> this remains null
Regards,
Sam
The [Returnstatus] of the execution is -1
>>>>> SetVar [ReturnStatus] [Status]
but i can't see the error, it's not Displayed.
>>>>> SetObjectHTML "Container1" "[Data]" -----> this remains null
Regards,
Sam

Quote from lesanch on March 6, 2020, 9:17 pmproblem resolved, i can't be such as stup... :-DD.
Sorry, web server problems :-)
Regards,
Sam
problem resolved, i can't be such as stup... :-DD.
Sorry, web server problems :-)
Regards,
Sam