from BaseHttpServer import (BaseHTTPRequestHandler,HTTPServer)def main(port=10000,HandlerClass=BaseHTTPRequestHandler,ServerClass=HTTPServer,protocol="HTTP/1.0"):server_address = ('', port)HandlerClass.protocol_version = protocolhttpd = ServerClass(server_address, HandlerClass)sa = httpd.socket.getsockname()print "Serving HTTP on", sa[0], "port", sa[1], "..."httpd.serve_forever()main()
$ spk init -p 10000 -- python hi.py$ spk devApp is now available from Sandstorm server. Ctrl+C to disconnect.
** SANDSTORM SUPERVISOR: Starting up grain. Traceback (most recent call last): File "/usr/lib/python2.7/site.py", line 563, in <module> main() File "/usr/lib/python2.7/site.py", line 545, in main known_paths = addusersitepackages(known_paths) File "/usr/lib/python2.7/site.py", line 272, in addusersitepackages user_site = getusersitepackages() File "/usr/lib/python2.7/site.py", line 247, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/usr/lib/python2.7/site.py", line 237, in getuserbase USER_BASE = get_config_var('userbase') File "/usr/lib/python2.7/sysconfig.py", line 578, in get_config_var return get_config_vars().get(name) File "/usr/lib/python2.7/sysconfig.py", line 529, in get_config_vars _CONFIG_VARS['userbase'] = _getuserbase() File "/usr/lib/python2.7/sysconfig.py", line 210, in _getuserbase return env_base if env_base else joinuser("~", ".local") File "/usr/lib/python2.7/sysconfig.py", line 196, in joinuser return os.path.expanduser(os.path.join(*args)) File "/usr/lib/python2.7/posixpath.py", line 269, in expanduser userhome = pwd.getpwuid(os.getuid()).pw_dir KeyError: 'getpwuid(): uid not found: 1000'
$ grep 1000 /etc/passwd|wc1 3 70
--
You received this message because you are subscribed to the Google Groups "Sandstorm Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sandstorm-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I don't really see how os.path.expanduser() can function in the absence of either of those, except perhaps with the support of a libnss-sandstorm. It seems that Python wants to call that function at start-up.
In principle, I'm at least +0 (on a range of -1 "I hate it" to +1 "I love it") to someone making an index of "things that can go wrong with various frameworks", but when the list starts to grow, and developers like Dan start to wonder if porting to Sandstorm is unnecessarily difficult, I'm hopeful that generally Sandstorm can change when we realize that certain difficulties are unnecessary.
So I support the idea of $HOME or a working /etc/passwd being available by default. These are just my early-morning thoughts, so I might have missed something important.
On Sun, Dec 21, 2014 at 10:47 PM, Kenton Varda <ken...@sandstorm.io> wrote:
>
> Instead of automatically adding hacks to the default template, I'd rather build an index of "things that go wrong with various frameworks" that people can refer to (and, longer-term, specialized tools for each framework that automate these things).
I added a "Framework-specific gotchas" section under
"Framework-specific tools" and noted this there...
https://github.com/sandstorm-io/sandstorm/wiki/Porting-Guide
It could probably be tidied up a bit.
> In this case, it seems like a bug in Python that it refuses to run in a userless environment. At some point someone ought to fix that. :)
Yes, it's a bug in python.
http://bugs.python.org/issue10496