Blender adding double forward slash (`//`) to image file paths on Mac TL;DR: Blender seems to be prepending spurious // before filepaths when loading images from script.

Steps to reproduce: Save the following minimal script in a filename of your choice (e.g. blender_test.py)

import bpy
D = bpy.data
D.images.load('/Users/path/to/image.jpg')  # A JPG image in a different folder. You'll need to change this.
D.images[0].use_fake_user = True
bpy.ops.wm.save_as_mainfile(filepath="./fromscript.blend")


Execute using:

blender -b -P blender_test.py


Now open fromscript.blend in blender GUI, fire up the Python console and  print the path of the just-loaded image. 

print(D.images[0].filepath)


I see the following in my console (part of the path has been redacted). Notice the two forward slashes in the path. When I load the image from the Python Console in the GUI, or using the dislog box, those slashes are not there. These two forward slashes are preventing my downstream commands (e.g. textured material creation) from seeing the loaded images. Why are there additional slashes when blender is executed as a script?



EDIT If I understand correctly, this is asking a different question, about linking images from a different machine using relative paths. My question asks about blender prepending slashes to an absolute path.
Turns out that the double forward slash is Blender's way of expressing relative file paths. E.g. ./file.jpg in a Unix filesystem is //file.jpg in Blender. So I needed to save my .blend file by turning off the default interpretation of filepaths as relative. 

Turns out that this modified question is already answered here: Absolute path of files in Blender (with Python).