OS interface

This is the place for queries that don't fit in any of the other categories.

OS interface

Postby zkab » Sun Sep 25, 2016 1:02 pm

I have no experience in Python and am trying to modify a .html.tmpl file.
What I want to do is get some values from OS.
When I run Python in interactive mode I get following - which is OK:
Code: Select all
>>> import os
>>> os.uname()
('Linux', 'weather-raspi', '4.4.13-v7+', '#894 SMP Mon Jun 13 13:13:27 BST 2016', 'armv7l')
>>> os.uname()[1]
'weather-raspi'
>>>

but when I include $os.uname()[1] in a page in the .html.tmpl file it will not work ... it gives
('Linux', 'weather-raspi', '4.4.13-v7+', '#894 SMP Mon Jun 13 13:13:27 BST 2016', 'armv7l')[1]
What is wrong ?
Last edited by ichabod801 on Sun Sep 25, 2016 1:17 pm, edited 1 time in total.
Reason: initial post, code tags
zkab
 
Posts: 1
Joined: Sun Sep 25, 2016 12:52 pm

Re: OS interface

Postby micseydel » Sun Sep 25, 2016 6:33 pm

This is an almost blind guess, since I'm not familiar with the exactly tools you're using, but how about instead of
Code: Select all
$os.uname()[1]

you do
Code: Select all
${os.uname()[1]}

?
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
micseydel
 
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 11 guests

cron