errno 13 in Python while saving a file in a directory - python

I am trying to download a file from the internet and saving it in a directory but I get an error "Permission denied", which is clear what is it.
Is there any way to give my application(I am developing a Qt4-desktop application) and using urllib for download and saving the file, it looks like this
urllib.request.urlretrieve(url,saveLocation,eventHandler)
I have tried to start application and my IDE as an admin in windows, but still I am getting this error

By using urllib.urlretrieve(url, filename="file.txt") you are able to save it to the folder the program is in. If you want to access other folder you have to be sure to have the right privilages to other folders.
In windows right click and go to properties of the folder you want to save in and change the folders permisions so that the user that the program is on will have read & write enabled in that folder.

Related

How to download a file from google drive without showing this action in the change history

If I have access to a folder with some files in google drive, it's possible to download this folder without showing any changes in history? The owner of the folder should not see that the file was downloaded. If it's possible in python please tell me how to do it.
I used to think about some script (with using Google API) or some service/site to resolve this problem.

How to set access rights to windows folder and files using python?

I need to use python to configure the file's access rights (I don't know exactly what it's called attached a screenshot). I have an application installer and it creates a folder in the system, this folder needs to be protected from the user, that is, to make it so that he could not edit, view and delete it. I've read a lot of articles, tried a lot of options, but unfortunately everything is even. os.chmod was mentioned a lot, but all the result I got from it was setting up a "read-only" file. How can I prevent the user from interacting with the folder and its files so that he could not remove the lock? But at the same time we should be able to interact with files using python scripts?

Download a file to a google driver folder using selenium in heroku

Can i use the url to a google drive folder as a download_path in selenium
for instance like this .Heroku error says file not found
mudopy.download_path(r"https://drive.google.com/drive/folders/1IPNuefeIXXCKm8Xxm3u1ekltxTF3dCT0")
According to the code of mudopy module, it saves the downloaded file into a local directory. So you can later upload that file to a google drive. Not sure if heroku allows to store something locally.
Moreover, the function mudopy.download_path does not download anything yet, but only creates a local file that stores the path to the folder where you want to save the downloaded files. And looks like Heroku does't even permit creating this file.

Getting Django to run a main.py file

I've written a scientific program in python which outputs a .png and a .pdf
I would like to execute this main.py file from a web interface, with a nice big button saying GO and then display the .png and download a .pdf
I'm using a Django framework to serve the page saying GO. How do i get it to:
run my main.py file?
return the .png file to html template?
download the file which is generated by the main.py script?
Thank you internet
This question is a little broad for a specific answer, but in general, one can:
Have the button access an API which will, on the server, in another thread, your main.py file.
Once the application is finished, move the generated files to a deterministic location that serves static files on your web server.
Provide the user a URL to the newly created file's location.
Have a cron job run to clear out old files in the static directory.

could not save preference file google-apps-engine

Just installed Google Apps Engine and am getting "could not save" errors.
Specifically if I go in to preferences I get
Could not save into preference file
C:\Usera\myname/Google\google_appengine_launcher.ini:No such file or directory.
So some how I have a weird path, would like to know where and how to change this. I have search but found nothing, I have done a repair reinstall of GAE
Can find nothing in the registry for google_appengine_launcher.ini
I first saw the error when I created my first Application
Called hellowd
Parent Directory: C:\Users\myname\workspace
Runtime 2.7 (PATH has this path)
Port 8080
Admin port 8080
click create
Error:
Could not save into project file
C:\Users\myname/Google\google_appengine_launcher.ini:No such file or directory.
Thanks
I think I have found the answer to my own question.
I have a small app I have written to backup my stuff to Google Drive, this app would appear to have an error in it that does not stop it from running but does cause it to make a file called
C:\Usera\myname\Google
Therefore GAE can not create a directory called C:\Usera\myname/Google nor a file called C:\Usera\myname/Google\google_appengine_launcher.ini
I deleted the file Google, made a directory called Google and ran the GAE, saved pereferences and all working

Categories