By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,742 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,742 IT Pros & Developers. It's quick & easy.

possible newline problems

P: n/a
I'm running some stupid little script that's supposed to alert me if
some fuse link exists. All i do is read in /proc/mounts and look to
match the fuse mount command in question, i'm doing this:

output = open("/www/htdocs/hatProductAdd/add/output.txt", "a")
for line in fileinput.input(['/proc/mounts']):
output.write(line)
if line == 's*********@website.com:/usr/home/sites/www.website.com/
web/PICTURES/django /www/htdocs/hatProductAdd/media/images/PICTURES/
django fuse rw,nosuid,nodev,user_id=0,group_id=0,max_read=6553 6 0 0':
print "it's mounted"
else:
print "it's not mounted"

For some reason though, it never properly matches the fuse line, even
if it's there. When i straight up print the lines as they're read i
see "/proc/mounts", but every line has an extra newline between them.
Should i be trying to mtch the newline character as well? Any help
would be great!
Nov 17 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Robocop wrote:
for line in fileinput.input(['/proc/mounts']):
This will include the newline at the end of every line.
if line == 's*********@website.com:/usr/home/sites/www.website.com/
web/PICTURES/django /www/htdocs/hatProductAdd/media/images/PICTURES/
django fuse rw,nosuid,nodev,user_id=0,group_id=0,max_read=6553 6 0 0':
You're comparing the line against a string that doesn't end with a newline.
Nov 18 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.