Is it safe to save files in python library? - python

I wanted to use python turtle and the code didn't work, until I saved the file in the python library. (it didn't work earlier giving an error message saying 'turtle' is not recognised)
When i saved the file in the library, i saved the file as “hello23.py” but it got saved in the library as "pytube-pytube-v12.0.0-0-ge85.py”
It's been saved by the same name of the pytube file. (“pytube” is the package used to download YouTube videos by python.) Why is that?
And I saved another file again by creating a new folder in the library. it got saved fine.
My OS is Mac, Is it safe to save files in the library? I’ve heard not to save user files in the library.

Related

Hide input json files during the conversion of python scripts into exe

I am making a console app to download gcp objects using service account GOOGLE_CREDENTIALS, which is stored in json file. When i buddle my project using auto-py-to-exe to make it as an exe file. The json file comes into this folder. I want to hide this file from user. Is there any way to do so??
You can use os.chmod at the end of your setup script to make any file of the build directory read-only. For example:
import os
import stat
os.chmod(path_to_file, stat.S_IREAD)
And also to hide use below :
stat.FILE_ATTRIBUTE_HIDDEN this indicates The file or directory is hidden. It is not included in an ordinary directory listing. Refer this Link how to use file attribute Hidden.
Refer this SO for more information

How to import python files in Google Colab

So I have been trying to make this file compatible to Google Colab but I'm not able to find any way to do it.
[]
EfficientDet-DeepSORT-Tracker is the main folder of this entire package
This picture is from one of the files placed alongside backbone.py
How to fix the fact that the file isn't able to detect backbone.py?
EDIT for more context: I shared the errors I found when trying to run waymo_open_dataset.py which isn't able to detect the other .py files alongside it.
According to this past question you could import 'filename' of the filename.py. So in the main.py file you are trying to run in colab, then import the required files in the main.py file.

Files downloaded from Dropbox API come as a Zip

I am trying to download a file from my Dropbox account, however, on Linux (Raspbian) when I execute the line:
dbx = dropbox.Dropbox(TOKEN)
dbx.files_download_to_file(LOCAL_PATH,r'/file.ppsx')
It is downloaded as a zip. I do not have this problem executing the code on Windows. I'd like to note the file is a .ppsx, a PowerPoint presentation file. I have no problem downloading it manually from Dropbox. My question is, how can I circumvent this problem and download it unzipped?
It seems that Dropbox sent the file not as a zip, but rather changed the name of the file to the directory of where it was installed. I circumvented this problem by using the os.rename module. This solved the problem and allowed me to open the file within the same script.

Problem with Tutorial About Making a Python .pyx File

I've looked for every possible way to create a .pyx file from saving a .py file. I followed this YouTube tutorial. However, when I used VSCode, it returned a blank .pyx file.
Thanks To davidw it's fixed Just by changing the File name and using the Correct Editor

Download file from Box

I am new to box, trying to upload and download file from the box using boxsdk uploading file is working fine for me. I got stuck with downloading file.
I have written code to download file as follows:
with open('destinationfilepath','wb') as file_object:
client.file('boxfileId').download_to(file_object)
file_object.close()
It's printing content of my file and finally getting error
as Nonetype object has to attribute 'readline' leaving with no content in destination file.
Just in case anyone stuck with this, I got it working by updating all pip packages I had, may be because of version mismatch it was not working.

Categories

Resources