I'm trying to build a python script and freeze it with cx-freeze but with Vista User Access Control support.
As it stands my script runs fine under Server 2003/Win XP, however I need to be able to write files into the root of a drive which requires elevated privileges under UAC.
My compiled script is then executed by another process (scheduling engine) which runs my script under a service account (with local Admin + domain admin rights) however because I don't have a manifest(?) and UAC is enabled, my script will always return permission denied errors.
Py2exe seems to have a solution for Vista UAC, however I am using cx-freeze with Python 3.1 because of requirements on new code in python 3.1 that I call.
Is there a solution to this (apart from disabling UAC which I can't get approved) for cx-freeze?
According to Python documentation UAC is automatically supported from version 2.6.
See http://docs.python.org/distutils/builtdist.html.
Related
Trying to have a python script open an app and then continue on. I have the following setup:
Windows PowerShell (PS) running on PC.
Mac Terminal running bash. ssh... into the PC.
In both windows I get the same "Windows PowerShell, Copyright (C) Microsoft..." etc. info and the same PS C:\... prompt. So it seems I'm in the right place.
Tried various things. In all cases, anything I do directly on the PC that successfully opens the app, when done at the same prompt in the ssh session on the Mac, gives all the same feedback, but doesn't actually open the app.
Things I've tried:
py .\open_mt5.py at the PS prompt, where that script is:
import subprocess
result = subprocess.Popen(['C:\\Program Files\\MetaTrader 5\\terminal64.exe'])
print(result)
py to start python REPL, then enter the above lines one by one. Notably, in both setups, the python REPL prompt becomes available immediately (as expected) and the output is the same, but again, the app doesn't open on the PC.
Just execute the app from the PS prompt: C:\'Program Files'\'MetaTrader 5'\terminal64.exe
...and a few other things.
I think this should work, but it doesn't. What am I missing?
Or, speaking to the end goal specifically: how can I have my python script, run via ssh, open that app on the PC (and of course not have that block the script from continuing)?
Thanks!
Couple of other details if it helps:
It seems the hiccup is somewhere in the ssh, since that's the difference in all cases. But it also seems to be a Windows thing, because if I ssh into another Mac and enter commands to open Mac apps, they open on the remote Mac, (as expected).
Everything else I've ever tried via ssh from the Mac (to a Mac or a PC) works the same as it does typing directly into the same prompt on the remote machine, including running an entire python based REST API server on the PC. So I'm pretty sure everything is configured more or less right.
The app in question needs to be running for my REST API to work as it includes a service that provides some of the functionality. My end goal is have the python script open the app at the start of everything it's doing to set up and run the REST API server, and do so without blocking the rest of the script of course.
New to python. Self-teaching. Desire to learn it (basics at least). New to Windows command line (cmd, PowerShell). Self-teaching. No desire to learn any more than required for specific project. (Mac/unix user normally). Hoping people can reply at that level. 😊
Mac: macOS Monterey 12.4. PC: Windows 10 Home 21H2, python 3.10.5, and the default Win 10 OpenSSH Server.
I have a Djnago web application on IIS 6 on one server. Is there a way that from this website I call another python script that is on another server in such a way that that script just run itself there?
Calling or Runnig that script in the usual way as internet says, is not working.
I always get the error of os.getcwd() and it also doesn't allow to change that directory.
I just want to run that python script there on that server from this server.
Can anyone help?
Normally, I would recommend using a framework like fabric or winrm if you want to run a python script on another server. Those frameworks use ssh or windows remoting functionality, respectively, to allow a python program to execute other commands (including python scripts) on other systems. If the target machine is a windows machine, be forewarned that you can run into all sorts of UAC issues doing normal operations.
I'm trying to install Cloud SQL Proxy for Google Cloud Platform on my Windows 10 64 bit OS, so I can use Python scripts to dump data into SQL. I'm following this guide to get it set up.
I created a project and a Google Cloud SQL instance from the Console without any issues, and it shows up in the SDK shell without any problems. After downloading the proxy installer and installing it, a dialog window opens up and then closes before I can read it.
When I go to the Google Cloud SDK shell and try to start the Cloud SQL Proxy with: cloud_sql_proxy.exe -instances="[MyInstanceConnectionName]"=tcp:3306
No matter how many times I try, it throws the error "Cloud Sql Proxy is not recognized as an internal or external command, operable program or batch file." I already tried re-downloading and re-executing the file but it still won't work.
I have Python 3.6 with Anaconda and Google Cloud SDK shell installed on Windows 10 64-bit.
When you download the cloud_sql_proxy file make sure to rename it as per instructions in the how to guide. Also make sure you save it in the root directory of where you will run it from. E.g. If you are running the command from C:/users/desktop>.\cloud_sql_proxy.exe -instances="[YOUR_INSTANCE_CONNECTION_NAME]"=tcp:3306 then the cloud_Sql_proxy file must be located in the root C drive.
Open PowerShell or whatever terminal you use and navigate to the folder you saved cloud_sql_proxy.exe then add .\ like so:
.\cloud_sql_proxy.exe -instances="[YOUR_INSTANCE_CONNECTION_NAME]"=tcp:3306
I had the same problem, and i solved it by adding .\ before
so it would be like this
.\cloud_sql_proxy.exe -instances="[YOUR_INSTANCE_CONNECTION_NAME]"=tcp:3306
and I used PowerShell instead of normal cmd
Go to folder where you save proxy exe file and run following command
.\{cloud_sql_proxy file name}.exe -instances={projectID}:{zone}:{sql instance name}:{database}=tcp:{port} -credential_file={service account file path}
For instance related detail go to the instance look for "Instance connection name"
Your command is missing .\ before cloud_sql_proxy.exe -instances="[MyInstanceConnectionName]"=tcp:3306
I'm trying to run my selenium scripts via Jenkins on Ubunt server 16.04 without GUI.
And before to open a web page it requires make an windows authentication. I created for Windows with AutoIT and it works good but now I have to execute via Jenkins on Ubunt server, and got the following error:
Using deprecated data structure for setting timeouts
java.io.IOException: Cannot run program "/usr/share/GlobalStagingERP/global.staging.erp/authentification/WindowsAuthenticationFireFoxCodeExample.exe": error=13, Permission denied
And I decided to do it with python and SciTE.
Also I tried 'https://username:password#my_url/' but it didn't work and got a fatal error.
This is an example how I'm using AutoIT script to handle authentication in window:
WinWaitActive("Authentication Required","")
MouseClick("left",331, 288,1)
Send("username")
Send("{TAB}")
Send("password")
Send("{ENTER}")
But how can I do it the same action in SciTE using python?
I have an After Effects script that renders a custom video based on strings passed to it via a webpage form and some python code. It runs just fine when I execute the python code from a remote desktop connection using the administrator account. However when I try to execute it via the web page I can see that After Effects blinks on for a second in the Task Manager but it fails to output any files like it does when run as the administrator.
I'm assuming this is due to some crazy permissions issues with IIS. I've added the after effects executable directory as a virtual directory in IIS. I've also allowed the after effects executable file in the CGI restrictions. I've also set the executables folder to allow read, write, and execute permissions for the IIS-User account.
Any ideas?