0
Issue in creating python file with extension .py on dektop
I am using VM box with Windows 10 as host and running Ubuntu16.04. while creating a file with extension .py , it create a plane text file . how can I solve this?
10 Antworten
+ 1
Are you sure that it does not have a txt extension?
If the file extensions are "hidden", you may think your file is yourfile.py but it really is a yourfile.py.txt
+ 1
Go in your windows VM and do it from there.
+ 1
In Windows, when saving the file, try click on the box that says "Text file (.txt)" (or something similiar) and select "all files". Now try saving it again.
+ 1
in your ubuntu ternimal, write touch newfile.py. this will create a new py file with the name newfile
+ 1
a python file is a text file. on windows you can associate the extension with the python executor,
on Linux you have to :
add the line
#!/path_to_python_executable/python
at the very top to get the same result
(Also the script must have executable permissions.)
Alternatively, running
#python yourscript.py
always work
0
how can I access it's hidden extension in Ubuntu
0
I ' ll already tried this but plane text file is created no pathan file
0
Nilesj So if you type "touch newfile.py" does it make a file called "newfile.txt"?
0
Not exactly it will create newfile.py but in properties it's shows plane text file
0
There is no file extension dependencies on linux systems. adding a .py to a file does not make it python file. Running "python myfile" and "python myfile.py" will show same output