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?

12th Aug 2018, 9:54 AM
Nilesj
Nilesj - avatar
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
12th Aug 2018, 10:01 AM
ifl
ifl - avatar
+ 1
Go in your windows VM and do it from there.
12th Aug 2018, 10:06 AM
ifl
ifl - avatar
+ 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.
12th Aug 2018, 10:25 AM
ReimarPB
ReimarPB - avatar
+ 1
in your ubuntu ternimal, write touch newfile.py. this will create a new py file with the name newfile
13th Aug 2018, 12:06 PM
Qwertiony
Qwertiony - avatar
+ 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
14th Aug 2018, 10:16 AM
ifl
ifl - avatar
0
how can I access it's hidden extension in Ubuntu
12th Aug 2018, 10:02 AM
Nilesj
Nilesj - avatar
0
I ' ll already tried this but plane text file is created no pathan file
13th Aug 2018, 12:50 PM
Nilesj
Nilesj - avatar
0
Nilesj So if you type "touch newfile.py" does it make a file called "newfile.txt"?
13th Aug 2018, 1:34 PM
ReimarPB
ReimarPB - avatar
0
Not exactly it will create newfile.py but in properties it's shows plane text file
14th Aug 2018, 8:16 AM
Nilesj
Nilesj - avatar
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
14th Aug 2018, 9:16 AM
Qwertiony
Qwertiony - avatar