Call of addon image as plane addon from python

I am building a simple python script that creates a plane with an image (image as plane addon). I call blender by the command line :
blender -P pattern_blender_smartphone.pyHere is the content of pattern_blender_smartphone.py :
import os
import bpy

def initScene():
file = os.path.abspath(‘C:/Users/John/PycharmProjects/untitled/cowboy_bebop.jpg’)
bpy.ops.import_image.to_plane(
use_shadeless=True,
files=[{‘name’: os.path.basename(file)}],
directory=os.path.dirname(file)
)

initScene()When i execute blender by the command line with this script i get these errors :

SCRIPT STARTING

Error: Traceback (most recent call last):
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 320, in execute
self.import_images(context)
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 333, in import_images
self.set_image_options(img)
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 449, in set_image_options
image.use_alpha = self.use_transparency
AttributeError: ‘NoneType’ object has no attribute ‘use_alpha’

location: C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules\bpy\ops.py:189

Traceback (most recent call last):
File “<string>”, line 1, in <module>
File “<string>”, line 43, in <module>
File “<string>”, line 11, in initScene
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules\bpy\ops.py”, line 189, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Traceback (most recent call last):
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 320, in execute
self.import_images(context)
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 333, in import_images
self.set_image_options(img)
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 449, in set_image_options
image.use_alpha = self.use_transparency
AttributeError: ‘NoneType’ object has no attribute ‘use_alpha’

location: C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules\bpy\ops.py:189

Traceback (most recent call last):
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 320, in execute
self.import_images(context)
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 333, in import_images
self.set_image_options(img)
File “C:\Program Files\Blender Foundation\Blender\2.75\scripts\addons\io_import_images_as_planes.py”, line 449, in set_image_options
image.use_alpha = self.use_transparency
AttributeError: ‘NoneType’ object has no attribute ‘use_alpha’

location: C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules\bpy\ops.py:189

location: C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules\bpy\ops.py:189
Read new prefs: C:\Users\John\AppData\Roaming\Blender Foundation\Blender\2.75\config\userpref.blend
found bundled python: C:\Program Files\Blender Foundation\Blender\2.75\python
Saved session recovery to ‘C:\Users\John\AppData\Local\Temp\quit.blend’

Blender quit
AL lib: (EE) UpdateDeviceParams: Failed to set 44100hz, got 48000hz insteadI have already tried to execute a blender instance and run the script with the GUI and it works but when i launch it by the command line i get errors. Have you guys any ideas why it doesn’t work?

Path of the file was not set right.