resource_stream.py 335 B

123456789101112131415
  1. import uio
  2. import sys
  3. try:
  4. uio.resource_stream
  5. except AttributeError:
  6. print('SKIP')
  7. raise SystemExit
  8. buf = uio.resource_stream("data", "file2")
  9. print(buf.read())
  10. # resource_stream(None, ...) look ups from current dir, hence sys.path[0] hack
  11. buf = uio.resource_stream(None, sys.path[0] + "/data/file2")
  12. print(buf.read())