+ 1

pass file name to a function

Hi all, I wrote a script to send an email, which receive 3 parameters, "Subject", "Path to file", "File name", when I run the function within same file it send properly the email, however when I call the function outside the file, I can see email is sent but in blank, nothing in subject, which is read from file passed to function. is any special object I need to pass? I pass as a string and then I use os.path.join to create file name thanks in advance. :D

8th May 2018, 3:29 PM
Joshue Perez
Joshue Perez - avatar
4 odpowiedzi
+ 1
You may use relative or absolute path for files in other folders
9th May 2018, 3:40 PM
Matthias
Matthias - avatar
+ 1
Could you show the code? Or at least the important part(s)
9th May 2018, 4:07 PM
Matthias
Matthias - avatar
+ 1
Hi Matthias thanks so much for your help I found what the issue was. when I ran the function inside same file, it worked properly and when I called from outside it failed because, when I called outside, also I passed file opened as w and then I try to open again in r mode, which seems is not possible, hence failed. thanks
9th May 2018, 9:09 PM
Joshue Perez
Joshue Perez - avatar
0
Yes, I do
9th May 2018, 3:47 PM
Joshue Perez
Joshue Perez - avatar