+ 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
4 odpowiedzi
+ 1
You may use relative or absolute path for files in other folders
+ 1
Could you show the code? Or at least the important part(s)
+ 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
0
Yes, I do