Prev: how to ensure item in list or dict bind with "an uuid meaning" integer type ID?
Next: Build unordered list in HTML from a python list
From: Baris CUHADAR on 30 Jun 2010 07:20 On Jun 30, 12:06 pm, Christian Heimes <li...(a)cheimes.de> wrote: > > Actually i wrote some scripts in python that are working as gateway > > controlling scripts iptables/tc/squid-proxy, and i want to execute > > them as cgi. Protection of source code is also important. These > > scripts works fine with ubuntu 9.10 and ubuntu 10.04, trying to > > eleminate this execution error and successfully port them to centos > > 5.4. Or i have to rewrite these scripts in C which is time comsuming. > > It looks like you have the binfmt kernel feature installed and > configured on your Ubuntu machines. Do you have some Python related > files in /proc/sys/fs/binfmt_misc/ ? > > Christian Thanks Christian, before your message i was thinking about writing wrapper to turn round this issue. my wrapper: #!/usr/bin/bash /usr/bin/python m_file.pyc Yes /proc/sys/fs/binfmt_misc/python2.6 is there. enabled interpreter /usr/bin/python2.6 flags: offset 0 magic d1f20d0a How can make it possible in centos? With custom kernel compiling?
From: Baris CUHADAR on 30 Jun 2010 08:07 On Jun 30, 2:20 pm, Baris CUHADAR <189...(a)gmail.com> wrote: > On Jun 30, 12:06 pm, Christian Heimes <li...(a)cheimes.de> wrote: > > > > Actually i wrote some scripts in python that are working as gateway > > > controlling scripts iptables/tc/squid-proxy, and i want to execute > > > them as cgi. Protection of source code is also important. These > > > scripts works fine with ubuntu 9.10 and ubuntu 10.04, trying to > > > eleminate this execution error and successfully port them to centos > > > 5.4. Or i have to rewrite these scripts in C which is time comsuming. > > > It looks like you have the binfmt kernel feature installed and > > configured on your Ubuntu machines. Do you have some Python related > > files in /proc/sys/fs/binfmt_misc/ ? > > > Christian > > Thanks Christian, before your message i was thinking about writing > wrapper to turn round this issue. > > my wrapper: > #!/usr/bin/bash > > /usr/bin/python m_file.pyc > > Yes /proc/sys/fs/binfmt_misc/python2.6 is there. > > enabled > interpreter /usr/bin/python2.6 > flags: > offset 0 > magic d1f20d0a > > How can make it possible in centos? With custom kernel compiling? According to this documentation below, i've solved my problem. http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/binfmt_misc.txt;hb=HEAD registered .pyc extension to invoke python interpreter. Done, thank you everybody, especially Christian..
From: Thomas Jollans on 30 Jun 2010 08:10 On 06/30/2010 01:20 PM, Baris CUHADAR wrote: > On Jun 30, 12:06 pm, Christian Heimes <li...(a)cheimes.de> wrote: >>> Actually i wrote some scripts in python that are working as gateway >>> controlling scripts iptables/tc/squid-proxy, and i want to execute >>> them as cgi. Protection of source code is also important. These >>> scripts works fine with ubuntu 9.10 and ubuntu 10.04, trying to >>> eleminate this execution error and successfully port them to centos >>> 5.4. Or i have to rewrite these scripts in C which is time comsuming. >> >> It looks like you have the binfmt kernel feature installed and >> configured on your Ubuntu machines. Do you have some Python related >> files in /proc/sys/fs/binfmt_misc/ ? >> >> Christian > > Thanks Christian, before your message i was thinking about writing > wrapper to turn round this issue. > > my wrapper: > #!/usr/bin/bash > > /usr/bin/python m_file.pyc > > Yes /proc/sys/fs/binfmt_misc/python2.6 is there. > > enabled > interpreter /usr/bin/python2.6 > flags: > offset 0 > magic d1f20d0a > > How can make it possible in centos? With custom kernel compiling? The binfmt_misc module has to be loaded, which is presumably is, if /proc/sys/fs/binfmt_misc exists (not 100% sure on that) It's almost certainly provided by CentOS, even if it's not loaded by default. Assuming file.pyc was actually compiled by python2.6, and not some other version, it should work. -- Thomas
From: Baris CUHADAR on 30 Jun 2010 09:32
On Jun 30, 3:10 pm, Thomas Jollans <tho...(a)jollans.com> wrote: > On 06/30/2010 01:20 PM, Baris CUHADAR wrote: > > > > > On Jun 30, 12:06 pm, Christian Heimes <li...(a)cheimes.de> wrote: > >>> Actually i wrote some scripts in python that are working as gateway > >>> controlling scripts iptables/tc/squid-proxy, and i want to execute > >>> them as cgi. Protection of source code is also important. These > >>> scripts works fine with ubuntu 9.10 and ubuntu 10.04, trying to > >>> eleminate this execution error and successfully port them to centos > >>> 5.4. Or i have to rewrite these scripts in C which is time comsuming. > > >> It looks like you have the binfmt kernel feature installed and > >> configured on your Ubuntu machines. Do you have some Python related > >> files in /proc/sys/fs/binfmt_misc/ ? > > >> Christian > > > Thanks Christian, before your message i was thinking about writing > > wrapper to turn round this issue. > > > my wrapper: > > #!/usr/bin/bash > > > /usr/bin/python m_file.pyc > > > Yes /proc/sys/fs/binfmt_misc/python2.6 is there. > > > enabled > > interpreter /usr/bin/python2.6 > > flags: > > offset 0 > > magic d1f20d0a > > > How can make it possible in centos? With custom kernel compiling? > > The binfmt_misc module has to be loaded, which is presumably is, if > /proc/sys/fs/binfmt_misc exists (not 100% sure on that) > It's almost certainly provided by CentOS, even if it's not loaded by > default. > > Assuming file.pyc was actually compiled by python2.6, and not some other > version, it should work. > > -- Thomas Yes centos5.4 loads it automatically, however little kickstart script in "/etc/rc.local" is required. is_python=$(ls -l /proc/sys/fs/binfmt_misc/python2.4 | wc -l) if [ $is_python -lt 1 ]; then echo ':python2.4:E::pyc::/usr/bin/python:' > /proc/sys/fs/binfmt_misc/ register fi i'm still digging in.. |