I want to make .py as standard filetype in Visual Studios Code, so I don´t have to search "Python" every time I save files. I only learn python so it would be very nice.
Presumably you're on Windows and trying to choose the file type when going through the Save dialog. You actually don't have to change the file type; all it does is save you from having to type .py at the end of your file name. If you write the whole file name out with file extension then VS Code will not add the default .txt file type extension.
Related
I have recently downloaded some models for blender but when I unzipped it the file was in .py format I want to add them to my project but I cant I tried "open in" method but no results..... can anyone tell me how to fix it
You can simply change its format from .py to .blend
you can do this with help of notepad.
open .py file in notepad and save as .blend format.
Please specify what the content of the .py file is.
A .py file is a python script, and you can't just "convert" it in a blender file. They are two different things.
It might be the case that the .py file is just a text file (saved as a .py file) that contains the coordinates of a mesh. In this case, just change .py in .obj and import it in blender.
I Created a Program That Has 2 .py files.
I Want To Make The Program a .exe file, I do it using cx_Freeze.
My Problem Is That I Convert The main.py To .exe but The Second Python File Is Still a .py File.
I Don't Want It Be a .py Because If It Is The User Can See The Code.
If I Also Convert The Second Python File The Program Doesn't Work Because I import The Python File In The Main File.
Any Suggestions?
(I Don't Want To Copy The Second Python File To The Main Python File)
You are chasing the wrong rabbit here. The various tools that generate executable files from Python code are not compilers. They are just tools that embed a Python interpretor with py (or pyc) files to allow users to use the program without a prior Python installation.
Said differently you should not use them to hide your code (except from people not knowing a lot of Python): a pyc does not contain text code but according to the answers to Is it possible to decompile a compiled .pyc file into a .py file? , tools exists that convert back a pyc file into a py file (of course except the comments).
IMHO, you should better google for python obfuscate to find tools dedicated to obfuscation, what neither cx-freeze nor pyinstaller are.
BTW while there are appropriate use cases for obfuscation you should be aware that a determinate attacker can always circumvent it. The reason why the real protection for intellectual property is law and not technics...
I'm not sure how two or more .py files can be converted to .exe.
But in python the easiest way to convert to .exe is a module named pyinstaller .
You can install it using command pip install pyinstaller can get it . After just go to the directory where your project files are and open command prompt in that directory and execute pyinstaller file_name
I want to make a programming language with a specific end of the files (.example) which can be in every folder and executed by the python file (example/example.py) with the argument where the .example file is, that the python file can open it.
I've already tried it to setup in the normal Windows Settings and on the .example itselfs (open with), but there is no chance for making it work.
Solution
arbitrary custom file extensions can be run with Windows python using the file association feature of windows
Step by step (Windows 7)
create you new file extension
open the file as usual
you will see unable to find software to open this file
choose ... search through windows
choose ... Select a program from a list of installed programs
choose ... Always use the selected program to open this kind of file
navigate to the directory containing pythonw.exe
Screenshot
https://drive.google.com/file/d/0BwR0ium7uufRWnhXWWNFcVJ3S2c/edit?usp=sharing
The files that are blank and say "Credit Card Balance" and "mine" are the files which I created by opening up a new document in IDLE and creating a file. The ones with the little pictures and say ps2_newton are programs which I downloaded off of the internet. I can't open my files which I created like they are regular programs and have to open them under notepad to see the code. Why is this? How can I change my files to look and act like the ones I downloaded?
The files you downloaded have an extension of ".py", which tells Windows to open them with the Python launcher, while the ones you created have no extension, or an extension of ".txt", which tells Windows to open them in Notepad.
Since ".py" and ".txt" are both "known extensions", and you have Explorer configured to hide known extensions (which I believe is the default in all versions of Windows), it doesn't show them to you. However, you can see the difference in the icons.
You can configure Explorer to show all extensions, but this site is not the place to ask about that—try SuperUser.
Meanwhile, when you save your scripts, make sure you save them with a .py extension (or, if they're Tkinter or other GUI apps, with a .pyw extension).
I had the same problem. But I just deleted all of the é's and á's etc. And it worked! So try that IF it is an .py file. Otherwise I understand if it does not work becouse it isn't a python file. You change that by doing this: Save as. Just simply type .py after the file name.
PS Sorry for my bad english...
In Python IDE, while we save the script, it will prompt the save Dialog. If we specify the filename as "Test". Then file will be saved without extension as "Test" and not "Test.py".
Is it possible to save the script with .py extension automatically (as Test.py)?
Unfortunately, IDLE doesn't and can't add the .py extension automatically; you will just have to get into the habit of adding it yourself, or use another IDE like Eclipse or Komodo that will do it for you.
There is a bug report for IDLE about this: http://bugs.python.org/issue10364
If you want, you can edit IDLE itself to do this for you. A good place to start is save_as in IOBinding.py.