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
Related
I updated my python version and when I try to run server on prompt for django I get this error.
Unable to create process using 'C:\Users\ALFRED\AppData\Local\Programs\Python\Python311\python.exe
manage.py runserver': The system cannot find the file specified.
This error occurs when the file system of the target device is corrupted or damaged, making your hard drive, USB or external hard drive inaccessible.
Are you sure you typed the right command python manage.py runserver.
I want to run python script on google cloud using android studio
ex: I have an android application which contain button and google cloud VM instance which has a python script.
I want when click button, the script is run and output send to storage.
how I can do that ?
I suppose you're running a linux-based distribution as your operating system. I think that you could do that by sending a command to the VM via ssh, and by using pipes in linux you could direct the output to a specific file.
Let's say you have your python script named script_one.py
With this command python3 script_one.py > output.txt you basically run the script and the output of it is stored in the file output.txt in the same directory where the python script is, now of course you could use absolute or relative path to redirect your output to another place.
Depending on the language you're developing your application in, this can be implemented in different ways.
I am trying to connect to oracle DB to execute some SQL queries and fetch data through a python script . I have imported cx_Oracle and tried connecting.I got the error as - Exception - DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help was raised.
I downloaded instaclient and used that in my script and it worked using the below commands :
LOCATION = r"C:\instantclient_19_5"
os.environ["PATH"] = LOCATION + ";" + os.environ["PATH"]
But now I need to use this in CI CD pipeline. I have created a docker image for instaclient and python I am trying use this into my script. But I am not sure how to use add instaclient location in script (like the above code snippet) Could you please help me with this.
If you were deploying to Windows (or macOS), you could have used the new cx_Oracle 8 init_oracle_client() function, which is preferred to fiddling with PATH.
However it seems you are deploying to Linux, meaning the system library search path needs to contain all library directories before the process start. So you need to use ldconfig or set LD_LIBRARY_PATH as traditionally used on Linux. The cx_Oracle doc Installing cx_Oracle on Linux and Locating the Oracle Client Libraries covers this.
Also see sample docker images for Linux developers and for basic Oracle Instant Client. If you are not on an RPM based system, check out the sample Docker files in Docker for Oracle Database Applications in Node.js and Python.
In summary, download Oracle Instant Client Basic or Basic Light packages from here. If you got the ZIP files then run something like:
RUN echo /opt/oracle/instantclient_19_8 > /etc/ld.so.conf.d/oic.conf && \
ldconfig
The details vary with what base Docker image you are using, and whether you want to install Instant Client from ZIP files or RPMs.
i am new to the community and new in using servers and could use some help.
I am trying to setup an automatic JSON parser to another server using http post calls. The idea is as follows:
I manually put JSON files into a folder Input on the server
A python script that is always running on the server reads the files located within the folder
It reads the JSON files, posts all objects to another server, and moves the files to a "Processed" folder one file at a time.
I have been given a Windows Server, with Windows Server Manager 2016, and have managed to do the following:
installed python 3.8.2. on the windows server
able to run a python script using powershell
Installed NSSM to create a windows service
Now the windows server manager says i cannot resume or start the service that i tried to install via NSSM.
I am very new to servers, as well as python itself. Can somebody help me to get a python script running 24/7 on a windows server with windows server manager 2016?
Edit:
I managed to create a python script that can read files, upload them and move them to a processed folder, but i still have to run it by myself while i want it to always run on the server
I'm working on MAC application contains a command line tool.
The GUI (electron) using sudo prompt to run the command line tool written in Python.
Under Catalina, the app all needed permission to w/r for the protected directories like Desktop with no issue.
Needed permission request were added to plist and it is signed with list of entitlements.
All works well except accessing external hard drive. Any try to create folder or modifying its properties using chmod command for example return with permission denied.
Just for note, calling same command from terminal ends well with no issue
Any ideas how I can go over it?
How App can request Full disk access?