I used dir=os.path.abspath(“C:/tmp/”) is a good way to use paths.
Also I have the 2.79a version now.
I cannot read files in Blender python (but same source code works fine on python 3.6.x).
You can see the bug I open https://developer.blender.org/T54514
About your idea with context then that just change area window from python text area to SEQUENCE_EDITOR
The main problem to add images is the function: image_strip_add.poll()
The file reading issue is a permission issue, probably Blender (or Blender’s python interpreter) doesn’t have the permissions to read files from c: mp. Can you read files from other folders?
If you want to use the system’s temp folder consider using the tempfile module
I need a good example versus API 2.79a on my issue.
I understand the context issue and the error info - is failing because the context , the result is not working.
I don’t make changes on OS to Blender 3D - is a default install, but
my python 3.6.x install (not Blender 3D python) is running good , see:
C:\Python364>python.exe
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import os
>>> dir=os.path.abspath(“C:/tmp/”)
>>> for i in os.listdir(dir):
print(i)
…
0001.png
0002.png
0003.png
the bug has close and refer a function on API not : BlendDataImages(bpy_struct) - version 2.79
your reply use the version 2.78 scene.sequence_editor.sequences.new_image()