On Tue, Nov 26, 2013 at 1:28 PM, Rick Johnson
<rantingrickjohn...@gmail.com> wrote:
> The only sure fire method to prevent a file containing
> Python code from executing on a machine with Python
> installed is to use an extension that the system will not
> associate with Python.
>
>  ScriptFolder/
>    script.py
>    mod_1.ignore
>    mod_2.ignore
>    ...

Windows:
C:\Documents and Settings\M>copy con test.ignore
print("Hello, world!")
^Z
        1 file(s) copied.

C:\Documents and Settings\M>python test.ignore
Hello, world!

Linux:
gideon@gideon:~$ cat >test.ignore
print("Hello, world!")
gideon@gideon:~$ python test.ignore
Hello, world!

Totally sure-fire. Absolutely prevents any execution until it's
renamed. By the way, what does "associate" mean, and what does it have
to do with file names?

gideon@gideon:~$ cat >test.ignore
#!/usr/bin/python
print("Hello, world!")
gideon@gideon:~$ chmod +x test.ignore
gideon@gideon:~$ ./test.ignore
Hello, world!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to