Un-printable characters (including cr/lf) in the data read from the file?

> I'm trying to read the content of a file to specify the name of a server to a 
> python script. If I set the variable directly, it works fine If I read the 
> file, the script fails with a 'can't find server' error. 
> 
> Setting the hostname directly is easy enough:
> 
> SERVER_NAME = fqdn.domain.net
> 
> That works fine... Adding a print to the script prints the appropriate 
> hostname.
> 
> If, however, I try to read the filename from a file, I get what amounts to a 
> host not found error:
> 
> f1 = open('/path/to/file', 'r')
> 
> SERVER_NAME = f1.read()
> f1.closed
> 
> And again, printing the variable prints the correct hostname, but when the 
> script attempts to access the host, it can't find the host. 
> 
> Ideas? 
> 
> Russell Johnson
> [email protected]
> 
> 
> 
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug


_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to