I have a serious privileges problem that is making it impossible to serve python pages on a CentOS server. I have tried to resolve this problem in my last post, but now it appears that interest has petered out. I'm desperate and hoping someone on this list can help.
[Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] (2)No such file or directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer: http://angrynates.com/global_solutions/ [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] Premature end of script headers: index.py, referer: http://angrynates.com/global_solutions/
Now, the file does exist:
[root@13gems global_solutions]# pwd /var/www/html/angrynates.com/global_solutions [root@13gems global_solutions]# ls .... -rwxr-xr-x 1 victor victor 275 Nov 6 07:05 index.py .... and it serves just fine on another server, so there is no "premature end of script headers".
Here's where it gets really weird. If I copy the code for index.py and template.py which the former calls, and create files test.py and test2.py and paste the code from the former files in those new files changing only the import statement from "template" to "test2", the tests will resolve!! Now, the ownership and mode are identical on all of them!!
[root@13gems global_solutions]# ls -al | grep test.py -rwxr-xr-x 1 root root 298 Nov 6 12:24 test.py [root@13gems global_solutions]# ls -al | grep test2.py -rwxr-xr-x 1 root root 5716 Nov 6 12:25 test2.py [root@13gems global_solutions]# ls -al | grep index.py -rwxr-xr-x 1 root root 316 Nov 6 07:05 index.py [root@13gems global_solutions]# ls -al | grep template.py -rwxr-xr-x 1 root root 5806 Nov 6 07:06 template.py -rwxr-xr-x 1 root root 6093 Nov 6 07:06 template.pyc
where test.py is identical to index.py (other than the necessary import) and template is identical to test2.py
fixfiles relabel /var/www/html # might just work It didn't
touch /.autorelabel # and then reboot will relabel all copied files to the correct contexts for the location I rebooted apache with no luck
or you could turn off SELinux and reboot I did that and the following two solutions with no luck: echo 0 >/selinux/enforce
[root@13gems ~]# cd /etc/ [root@13gems etc]# mv selinux/ selinux.BAK [root@13gems etc]# mkdir selinux [root@13gems etc]# echo 0>/selinux/enforce
...and the problem continues: [root@13gems etc]# tail /var/log/httpd/error_log [Fri Nov 06 12:51:49 2009] [error] [client 66.248.168.98] Premature end of script headers: index.py, referer: http://angrynates.com/global_solutions/ [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] (2)No such file or directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer: http://angrynates.com/global_solutions/ [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] Premature end of script headers: index.py, referer: http://angrynates.com/global_solutions/ [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] (2)No such file or directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py' failed [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] Premature end of script headers: index.py [Fri Nov 06 13:52:15 2009] [error] [client 66.249.67.153] File does not exist: /var/www/html/angrynates.com/robots.txt [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] (2)No such file or directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer: http://angrynates.com/global_solutions/ [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] Premature end of script headers: index.py, referer: http://angrynates.com/global_solutions/ [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] File does not exist: /var/www/html/angrynates.com/favicon.ico [Fri Nov 06 13:52:53 2009] [error] [client 208.84.198.58] File does not exist: /var/www/html/angrynates.com/favicon.ico [root@13gems etc]#
Please help. Victor
Victor:
I have a serious privileges problem that is making it impossible to serve python pages on a CentOS server. I have tried to resolve this problem in my last post, but now it appears that interest has petered out. I'm desperate and hoping someone on this list can help.
You need to move to a host that includes support or hire a consultant.
Neil
-- Neil Aggarwal, (281)846-8957, http://www.JAMMConsulting.com CentOS 5.4 KVM VPS $55/mo, no setup fee, no contract, dedicated 64bit CPU 1GB dedicated RAM, 40GB RAID storage, 500GB/mo premium BW, Zero downtime
On Sat, Nov 7, 2009 at 9:23 AM, Neil Aggarwal neil@jammconsulting.comwrote:
Victor:
I have a serious privileges problem that is making it impossible to serve python pages on a CentOS server. I have tried to resolve this problem in my last post, but now it appears that interest has petered out. I'm desperate and hoping someone on this list can help.
You need to move to a host that includes support or hire a consultant.
Nonsense. You can't solve it either, can you? You're as stumped as the rest of us...but arrogant, too. V
Neil
-- Neil Aggarwal, (281)846-8957, http://www.JAMMConsulting.com CentOS 5.4 KVM VPS $55/mo, no setup fee, no contract, dedicated 64bit CPU 1GB dedicated RAM, 40GB RAID storage, 500GB/mo premium BW, Zero downtime
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Nonsense. You can't solve it either, can you? You're as stumped as the rest of us...but arrogant, too. V
Victor,
To be brutally honest, you haven't given the list the info we need to help you solve this problem. I've been following this thread and so far I'm seeing a puzzle with half the pieces missing.
That said the first line of your error messages typically indicates that the script can't find the python executable pointed at by the script on the #! line.
On Sat, Nov 7, 2009 at 10:05 AM, Drew drew.kay@gmail.com wrote:
Nonsense. You can't solve it either, can you? You're as stumped as the
rest
of us...but arrogant, too. V
Victor,
To be brutally honest, you haven't given the list the info we need to help you solve this problem. I've been following this thread and so far I'm seeing a puzzle with half the pieces missing.
Can you please ask questions that I can answer so that you can help me?
That said the first line of your error messages typically indicates that the script can't find the python executable pointed at by the script on the #! line.
[root@13gems html]# ls /usr/bin/|grep pyth* python python2 python2.4
Someone asked for the code:
THIS IS index,py
#!/usr/bin/python
import string import cgitb; cgitb.enable() import cgi import sys,os sys.path.append(os.getcwd()) from template import template
ourFile = string.split(__file__, "/") page = ourFile[len(ourFile) - 1][:-3]
form = cgi.FieldStorage() w = form.getfirst('w', '1024')
template(page, w)
THIS IS template.py
#!/usr/bin/python
import cgitb; cgitb.enable() import cgi import sys,os sys.path.append(os.getcwd())
p = 'template'
def template(page, w): wn = int(w)/1024 print "Content-Type: text/html" print print ''' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <head xmlns="http://www.w3.org/1999/xhtml"> <style type='text/css'> .text { font-family: Arial, Helvetica, sans-serif; font-size: 16px; text-decoration: none; text-align: justify} </style> <title>Global Solutions Group</title> <meta http-equiv="distribution" content="Global" /> <meta http-equiv="robots" content="index all, follow all" /> <meta name="author" content="This web site developed by beno. You may reach him at his web site [beno.vi], or by dialing 340-773-0687 and asking for room 102." /> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} }
function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; }
function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; }
function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> </head> <body onload="MM_preloadImages('images/office-supplies-on.jpg','images/catalog-on.jpg','images/customer-template-on.jpg','images/forms-on.jpg','images/about-on.jpg','images/contact-on.jpg')"> <script language="JavaScript1.2" src="quickmenu/sample_data.js"></script> <script language="JavaScript1.2" src="quickmenu/dqm_script.js"></script>''' print "<table width='%s' bgcolor='#ffffff' cellpadding='0' cellspacing='0'><!--" % (str(wn*1008)) print '--><tr><!--' print '--><td><!--' print '--><img src="images/top.jpg" width="%s" height="%s" alt="" /><!--' % (str(wn*1008), str(wn*101)) print '--></td><!--' print '--></tr><tr><!--' print '--><td><!--' print '--><table align="left" width="%s" cellpadding="0" cellspacing="0"><!--' % (str(wn*1008)) print '--><tr><!--' print "--><td><img src='images/left.jpg' alt='' width='%s' height='%s' /></td><!--" % (str(wn*219), str(wn*21)) print '--><td><a href="index.py" onMouseOver="MM_swapImage("Home","","images/home-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/home-off.jpg" name="Home" id="Home" alt="Home" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*80), str(wn*21)) print '--><td><a href="Office_Supplies.py" onMouseOver="MM_swapImage("office-supplies","","images/office-supplies-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/office-supplies-off.jpg" name="office-supplies" id="office-supplies" alt="office supplies" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*137), str(wn*21)) print '--><td><a href="Catalog.py" onMouseOver="MM_swapImage("catalog","","images/catalog-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/catalog-off.jpg" name="catalog" id="catalog" alt="catalog" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*86), str(wn*21)) print '--><td><a href="Customer_Templates.py" onMouseOver="MM_swapImage("customer-template","","images/customer-template-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/customer-template-off.jpg" name="customer-template" id="customer-template" alt="customer template" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*145), str(wn*21)) print '--><td><a href="Forms.py" onMouseOver="MM_swapImage("forms","","images/forms-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/forms-off.jpg" name="forms" id="forms" alt="forms" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*84), str(wn*21)) print '--><td><a href="About_Us.py" onMouseOver="MM_swapImage("about","","images/about-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/about-off.jpg" name="about" id="about" alt="about us" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*101), str(wn*21)) print '--><td><a href="Contact_Us.py" onMouseOver="MM_swapImage("contact","","images/contact-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/contact-off.jpg" name="contact" id="contact" alt="contact us" width="%s" height="%s" border=0></a></td><!--' % (str(wn*100), str(wn*21)) print '--><td><img src="images/right.jpg" alt="" width="%s" height="%s" /></td><!--' % (str(wn*72), str(wn*21)) print '''--></tr><!-- --></table><!-- --></tr><tr><!-- --><td><!--''' print '--><table width="%s" cellpadding="0" cellspacing="0"><!--' % (str(wn*1008)) print '--><tr><!--' print '--><td width="%s"><!--' % (str(wn*1008)) print '--><img src="images/bottom.jpg" width="%s" height="%s" alt="" /><!--' % (str(wn*1008), str(wn*15)) print '''--></td><!-- --></tr><tr><!-- --><td><!-- --><table class="text"><tr><td><!-- ''' print '--><iframe src="%s_frame.py?p=%s&w=%s" width="%s" height="%s" frameborder="0"></iframe><!--' % (page, page, w, str(wn*988), str(wn*400)) print ''' --></td><!-- --></tr><!-- --></table> </body> </html> '''
TIA, V
-- Drew
"Nothing in life is to be feared. It is only to be understood." --Marie Curie _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Saturday 07 November 2009 09:14:06 Victor Subervi wrote:
I have a serious privileges problem that is making it impossible to serve python pages on a CentOS server. I have tried to resolve this problem in my last post, but now it appears that interest has petered out. I'm desperate and hoping someone on this list can help.
You may have better luck at a python list.
Plus you should never reveal the IP address where you are having problems as it may very well invite someone to take advantage of your problem and making things a lot worse.
Bobby
Victor Subervi wrote:
fixfiles relabel /var/www/html # might just work It didn't
touch /.autorelabel # and then reboot will relabel all copied files to the correct contexts for the location I rebooted apache with no luck
or you could turn off SELinux and reboot I did that and the following two solutions with no luck: echo 0 >/selinux/enforce
What do you mean by 'rebooted apache'? You have to reboot the whole machine to change selinlux settings.
Thank you. I just rebooted the machine. Unfortunately, that didn't help. V
On Sat, Nov 7, 2009 at 11:00 AM, Les Mikesell lesmikesell@gmail.com wrote:
Victor Subervi wrote:
fixfiles relabel /var/www/html # might just work It didn't
touch /.autorelabel # and then reboot will relabel all copied files to the correct contexts for the location I rebooted apache with no luck
or you could turn off SELinux and reboot I did that and the following two solutions with no luck: echo 0 >/selinux/enforce
What do you mean by 'rebooted apache'? You have to reboot the whole machine to change selinlux settings.
-- Les Mikesell lesmikesell@gmail.com
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Sat, Nov 7, 2009 at 11:12 AM, Victor Subervi victorsubervi@gmail.comwrote:
Thank you. I just rebooted the machine. Unfortunately, that didn't help. V
On Sat, Nov 7, 2009 at 11:00 AM, Les Mikesell lesmikesell@gmail.comwrote:
Victor Subervi wrote:
fixfiles relabel /var/www/html # might just work It didn't
touch /.autorelabel # and then reboot will relabel all copied files to the correct contexts for the location I rebooted apache with no luck
or you could turn off SELinux and reboot I did that and the following two solutions with no luck: echo 0 >/selinux/enforce
What do you mean by 'rebooted apache'? You have to reboot the whole machine to change selinlux settings.
-- Les Mikesell lesmikesell@gmail.com
Note that you copied files have different file sizes. (e.g. index.py and test.py).
Can you run index.py and template.py on the command line without error? You could easily have an indent error in one file.
Les Mikesell wrote:
Victor Subervi wrote:
fixfiles relabel /var/www/html # might just work It didn't
touch /.autorelabel # and then reboot will relabel all copied files to the correct contexts for the location I rebooted apache with no luck
or you could turn off SELinux and reboot I did that and the following two solutions with no luck: echo 0 >/selinux/enforce
What do you mean by 'rebooted apache'? You have to reboot the whole machine to change selinlux settings.
No, you don't. Either the echo, or the setenforce command will change it.
mark
2009/11/7 mark m.roth@5-cent.us:
What do you mean by 'rebooted apache'? You have to reboot the whole machine to change selinlux settings.
No, you don't. Either the echo, or the setenforce command will change it.
Rebooting probably turned SELinux back on again. Run the "setenforce permissive" command again and then try.
Ben
selinux must be off because I moved the whole folder to a backup. Regarding running index.py, how? I tried this: python index.py and it just printed the whole thing to screen. But I can't image how there would be an indent error. (1) This exact file without edit displays fine on another server. (2) I copied the whole thing and pasted it into test.py. I can't explain the size difference.
[root@13gems global_solutions]# diff index.py test.py 1,19c1,17 < #!/usr/bin/python < < import string < import cgitb; cgitb.enable() < import cgi < import sys,os < sys.path.append(os.getcwd()) < from template import template < < ourFile = string.split(__file__, "/") < page = ourFile[len(ourFile) - 1][:-3] < < form = cgi.FieldStorage() < w = form.getfirst('w', '1024') < < print page < < template(page, w) < ---
#!/usr/bin/python
import string import cgitb; cgitb.enable() import cgi import sys,os sys.path.append(os.getcwd()) from test2 import template
ourFile = string.split(__file__, "/") page = ourFile[len(ourFile) - 1][:-3]
form = cgi.FieldStorage() w = form.getfirst('w', '1024')
template(page, w)
On Sat, Nov 7, 2009 at 11:42 AM, Benjamin Donnachie benjamin@py-soft.co.ukwrote:
2009/11/7 mark m.roth@5-cent.us:
What do you mean by 'rebooted apache'? You have to reboot the whole
machine to
change selinlux settings.
No, you don't. Either the echo, or the setenforce command will change it.
Rebooting probably turned SELinux back on again. Run the "setenforce permissive" command again and then try.
Ben _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Victor Subervi wrote:
selinux must be off because I moved the whole folder to a backup. Regarding running index.py, how? I tried this: python index.py and it just printed the whole thing to screen. But I can't image how there would be an indent error. (1) This exact file without edit displays fine on another server. (2) I copied the whole thing and pasted it into test.py. I can't explain the size difference.
How did you get it from machine to machine? This could be a line-ending issue from a copy from windows or the wrong mode in ftp.
Hi
I install new linux in sda and try to recover the boot partition in sdb
I mount it /dev/sdb1 /bootpartion
but I can't chroot into it and grub-install
Can you help
[root@host ~]# chroot /bootpartion
chroot: cannot run command `/bin/bash': No such file or directory
Send instant messages to your online friends http://uk.messenger.yahoo.com
adrian kok wrote:
Hi
I install new linux in sda and try to recover the boot partition in sdb
I mount it /dev/sdb1 /bootpartion
but I can't chroot into it and grub-install
Can you help
[root@host ~]# chroot /bootpartion
chroot: cannot run command `/bin/bash': No such file or directory
was the system you're recovering built with a /boot and a seperate / ? thats not uncommon.
if thats the case, mount /dev/sdb2 /bootpartition && mount /dev/sdb1 /bootpartition/boot then try the chroot again. (I'm assuming /dev/sdb2 was the root and sdb1 was the /boot)
From: adrian kok adriankok2000@yahoo.com.hk
I install new linux in sda and try to recover the boot partition in sdb I mount it /dev/sdb1 /bootpartion but I can't chroot into it and grub-install Can you help [root@host ~]# chroot /bootpartion chroot: cannot run command `/bin/bash': No such file or directory
When you chroot /bootpartion, it does not see /bin anymore... You need bash inside, and proc and dev too I guess.
JD
You don't have to chroot to install grub on a different disk. Please read grub-install(8).
Frank.
John Doe wrote:
From: adrian kok adriankok2000@yahoo.com.hk
I install new linux in sda and try to recover the boot partition in sdb I mount it /dev/sdb1 /bootpartion but I can't chroot into it and grub-install Can you help [root@host ~]# chroot /bootpartion chroot: cannot run command `/bin/bash': No such file or directory
When you chroot /bootpartion, it does not see /bin anymore... You need bash inside, and proc and dev too I guess.
you need to mount the ROOT directory, then mount the /boot partition under that. assuming / is /dev/sdb2 and /boot is /dev/sdb1
# mount /dev/sdb2 /rootdir # mount /dev/sdb1 /rootdir/boot # chroot /rootdir
On Sat, Nov 7, 2009 at 12:04 PM, Les Mikesell lesmikesell@gmail.com wrote:
How did you get it from machine to machine? This could be a line-ending issue from a copy from windows or the wrong mode in ftp.
That is my guess too. This exact error will happen if the file is copied in Dos format to Linux.
Kwan Lowe wrote:
On Sat, Nov 7, 2009 at 12:04 PM, Les Mikesell lesmikesell@gmail.com wrote:
How did you get it from machine to machine? This could be a line-ending issue from a copy from windows or the wrong mode in ftp.
That is my guess too. This exact error will happen if the file is copied in Dos format to Linux.
ah, yes, python, where whitespace is a syntax element
Adding python debugging to apache revealed an import error. The strange thing is that when I load the exact lines of code in the command line python interpreter, it has no trouble importing the class in question.
With respect to the dos question, I've uploaded this exact code in its exact format (*.py files) to another server where it serves just fine. I can't find where to get dos2unix, but do I need it? V
On Sat, Nov 7, 2009 at 1:23 PM, John R Pierce pierce@hogranch.com wrote:
Kwan Lowe wrote:
On Sat, Nov 7, 2009 at 12:04 PM, Les Mikesell lesmikesell@gmail.com
wrote:
How did you get it from machine to machine? This could be a line-ending
issue
from a copy from windows or the wrong mode in ftp.
That is my guess too. This exact error will happen if the file is copied in Dos format to Linux.
ah, yes, python, where whitespace is a syntax element
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Victor Subervi wrote:
Adding python debugging to apache revealed an import error. The strange thing is that when I load the exact lines of code in the command line python interpreter, it has no trouble importing the class in question.
With respect to the dos question, I've uploaded this exact code in its exact format (*.py files) to another server where it serves just fine. I can't find where to get dos2unix,
Where have you looked??
# yum list dos2unix # yum install dos2unix
but do I need it?
Presently? Who knows. But it will come in handy at some point in time and it's only about 16K.
V
R
<snip>
On Sat, Nov 07, 2009 at 10:23:11AM -0800, John R Pierce wrote:
Kwan Lowe wrote:
On Sat, Nov 7, 2009 at 12:04 PM, Les Mikesell lesmikesell@gmail.com wrote:
How did you get it from machine to machine? This could be a line-ending issue from a copy from windows or the wrong mode in ftp.
That is my guess too. This exact error will happen if the file is copied in Dos format to Linux.
ah, yes, python, where whitespace is a syntax element
Not necessarily anything to do with python; a shell script or perl program would suffer the same problem.
See if a file beginning "#!/bin/sh" was sent as a DOS file then Unix would see it as "#!/bin/sh^M" (where ^M is the carriage-return character 0x0d) and so would try to run the script under "/bin/sh^M". This, clearly, doesn't exit. Same would be true for /usr/bin/perl^M or /usr/bin/python^M and so on.
Victor was told do to "dos2unix" which fixes the problem but he ignored the info ("dos2unix?! Huh? Where's the dos?") so *shrug*
As they say, you can lead a horse to water...
John R Pierce wrote:
Kwan Lowe wrote:
On Sat, Nov 7, 2009 at 12:04 PM, Les Mikesell lesmikesell@gmail.com wrote:
How did you get it from machine to machine? This could be a line-ending issue from a copy from windows or the wrong mode in ftp.
That is my guess too. This exact error will happen if the file is copied in Dos format to Linux.
ah, yes, python, where whitespace is a syntax element
And, IIRC, spaces and tabs are two *different* elements.
mark
2009/11/7 Victor Subervi victorsubervi@gmail.com:
selinux must be off because I moved the whole folder to a backup.
Did you edit /etc/selinux/config to disable it?
Please, just try the things people are suggesting rather than dismissing them instantly - it'll be much easier in the long run.
Ben
I moved /etc/selinux/config to /etc/selinux/config.BAK and created an empty folder to replace it. Then I rebooted the server.
It's been a while, but now I remember what a dos file looks like in a unix environment. No, these files look like unix files (without the carets and crap). TIA, V
On Sat, Nov 7, 2009 at 1:42 PM, Benjamin Donnachie benjamin@py-soft.co.ukwrote:
2009/11/7 Victor Subervi victorsubervi@gmail.com:
selinux must be off because I moved the whole folder to a backup.
Did you edit /etc/selinux/config to disable it?
Please, just try the things people are suggesting rather than dismissing them instantly - it'll be much easier in the long run.
Ben _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
2009/11/7 Victor Subervi victorsubervi@gmail.com:
I moved /etc/selinux/config to /etc/selinux/config.BAK and created an empty folder to replace it. Then I rebooted the server.
Check with the command getenforce please.
Ben
Victor Subervi wrote:
I moved /etc/selinux/config to /etc/selinux/config.BAK and created an empty folder to replace it. Then I rebooted the server.
It's been a while, but now I remember what a dos file looks like in a unix environment. No, these files look like unix files (without the carets and crap).
I'm not sure what you remember but with most ways of displaying files there is no visible different when a CRLF is present instead of just LF. If there's a difference in size that you can't see, and diff shows them as different, that's almost certain it.
Vim might show a [dos] in the bottom line when you load it, and could fix it by a :set fileformat unix and writing back.
On Sat, 07 Nov 2009 14:10:30 -0500 Victor Subervi wrote:
It's been a while, but now I remember what a dos file looks like in a unix environment. No, these files look like unix files (without the carets and crap).
The file command will verify that for you.
You said that this thing runs fine on another server. Is the other server running Linux or Windows? (Or something else?)
Frank Cox wrote:
On Sat, 07 Nov 2009 14:10:30 -0500 Victor Subervi wrote:
It's been a while, but now I remember what a dos file looks like in a unix environment. No, these files look like unix files (without the carets and crap).
The file command will verify that for you.
You said that this thing runs fine on another server. Is the other server running Linux or Windows? (Or something else?)
I've not been following this thread closely - can you run python -c script.py on the machine you're having trouble on?
mark
On 11/07/2009 08:33 PM, Frank Cox wrote: ...
The file command will verify that for you.
Are you sure?
$ cat test1.py #!/usr/bin/python
print "Hello World"
$ cat test2.py #!/usr/bin/python
print "Hello World"
$ ./test1.py Hello World $ ./test2.py ./test2.py: Command not found. $ file test1.py test2.py test1.py: python script text executable test2.py: python script text executable
test2.py is a copy of test1.py and changed by doing a :set ff=dos in vim.
Mogens
On Tue, 10 Nov 2009 07:53:30 +0100 Mogens Kjaer wrote:
The file command will verify that for you.
Are you sure?
Well, I guess not then. I assumed that "file" would treat a .py file as a text file. I don't do any programming with Python and haven't looked at it closely.
"file" tells me that a file that's created with Borland Turbo C (DOS) is "data", but a file of C source code that's created with Linux gedit is "ASCII C program text".
A text file that's created with the DOS "edit" command is "ASCII English text, with CRLF line terminators", and a text file that's created with Linux gedit is "ASCII text".
So file can tell the difference in pretty much every case except for a Python file. Which may be an oversight in the magic definitions.
On Tue, Nov 10, 2009 at 01:05:36AM -0600, Frank Cox wrote:
On Tue, 10 Nov 2009 07:53:30 +0100 Mogens Kjaer wrote:
The file command will verify that for you.
Are you sure?
Well, I guess not then. I assumed that "file" would treat a .py file as a text file. I don't do any programming with Python and haven't looked at it closely.
"file" tells me that a file that's created with Borland Turbo C (DOS) is "data", but a file of C source code that's created with Linux gedit is "ASCII C program text".
A text file that's created with the DOS "edit" command is "ASCII English text, with CRLF line terminators", and a text file that's created with Linux gedit is "ASCII text".
So file can tell the difference in pretty much every case except for a Python file. Which may be an oversight in the magic definitions.
I missed the early part so I am not sure what is "Serious" in this so excuse me for arriving late but it all appears normal and natural to me.
Python programs are of two types. Text files that are interpreted at runtime and have a first line that specifies the interpreter: #! /usr/bin/python and bytecode python programs.
A text file in DOS mode because the "#!" interpreter fails. If there is no white space after python the error makes more sense: $ ./bar.py bash: ./bar.py: /usr/bin/python^M: bad interpreter: No such file or directory
If there is white space after the n in python in the #! escape line the error is less clear.
The script with DOS mode or unix mode new line conventions can be compiled to python byte code or just executed with python. $ python ./bar.py Hello And compiled. $ ls -l bar* -rwxr-xr-x 1 bob bob 36 2009-11-13 20:25 bar.py
$ py_compilefiles bar.py Compiling bar.py ...
$ ls -l bar* -rwxr-xr-x 1 bob bob 36 2009-11-13 20:25 bar.py -rw-r--r-- 1 bob bob 108 2009-11-13 20:29 bar.pyc
$ chmod +x bar.pyc
$ ./bar.pyc Hello
$ file ./bar.pyc ./bar.pyc: python 2.6 byte-compiled
Since the #! escape for /usr/bin/python is seen in the text of the script by "file" it "corretly" notices that this is a python script. I say "correctly" because the python interpreter and compiler has no trouble with it.