[Users] Python script access to file(s) inside folder?

Pierre Fortin pf at pfortin.com
Thu Aug 8 22:35:31 CEST 2013


How do I get access to a file inside a folder...?

I'm trying to setup individual .signature files on a per folder basis;
but am missing the magic for understanding the difference between OS_path
[/home/pfortin/Mail/...] and claws_path [#mh/Mailbox/...]

This simple code segment:
print "/home/pfortin/Mail/inbox/tmp ==>"
print os.listdir("/home/pfortin/Mail/inbox/tmp")
print "{} ==>".format(clawsmail.get_folderview_selected_folder().get_identifier())
print os.listdir(clawsmail.get_folderview_selected_folder().get_identifier())

gives: 
/home/pfortin/Mail/inbox/tmp ==>
['.mh_sequences', '.signature', '.claws_cache', '.claws_mark']
#mh/Mailbox/inbox/tmp ==>
Traceback (most recent call last):
  File
"/home/pfortin/.claws-mail/python-scripts/compose/AddFolderSignature",
line 27, in <module> print
os.listdir(clawsmail.get_folderview_selected_folder().get_identifier())
OSError: [Errno 2] No such file or directory: '#mh/Mailbox/inbox/tmp'

which means the OS_path exists and contains files; but using the
claws_path to access them fails.  Or is this a bug?

Thanks,
Pierre



More information about the Users mailing list