Export in object format via script. The default cube appears in the scene!

I am importing a x3d file and then exporting in obj format using this simple script

import bpy,os

bpy.ops.import_scene.x3d(filepath='field.x3d', axis_forward='Z', axis_up='Y', filter_glob="*.x3d;*.wrl")

bpy.ops.export_scene.obj(filepath='test.obj')


However the resulting obj file contains the default cube! This is the x3d file:

This is the object file after the export:

Why that cube appears ? Does someone know how to avoid the cube in the object file?

Thank you very much for your help!

• Can't test so I wont answer. Most import scene operators leave the newly imported objects as selected. Most exporters have a use_selected property. Hence can deselect all, import, export selected, [remove selected] in a loop. – batFINGER Mar 14 '19 at 10:33