Have a look at python's platform module. For example: import platform if platform.system() == 'Windows': xxxx elif platform.system() == 'Linux': xxxx
On Tuesday, January 14, 2014 7:26:09 AM UTC+13, Jon Smith wrote: > > Hello I am trying to figure out how to detect if a computer is running > Windows or Macintosh then load the appropriate files and if any other > system Linux/Mobile etc then load the other files > > The reason for this is I am using Google Earth in a project and I want to > load Google Maps if it is not available > > I am trying to do this > > > {{if session._user_agent['os']['name'] == 'Macintosh' or > session._user_agent['os']['name'] == 'Windows':}} > > .... // do something > > {{else:}} > > // do something > > {{pass}} > > This however is creating an error if I try on my mobile device. I have not > had a chance to test on my Linux system yet. > > The error returned is: TypeError: 'NoneType' object has no attribute > '__getitem__' > > I am using the current stable release of web2py 2.8.2 (I think is the > version number) any suggestions in how I can do what I need? > > *Cheers > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.