Added workingdir option to Main: mainprogram = bitmessagemain.Main(workingdir='/tmp/testfolder')