Fix bug when .pyc files are present

If the main_module is given with extension, then just use it.
Only in the case the module has no extension in the metadata file, try to guess it.