Is it possible to return the filename of a python module as a string in that same module? Otherwise, is it possible for a module to return the filename of a different module as a string? I need a program to be able to pass it's filename into an argument as a variable. I've looked through the python 3.0 sys and os library and searched Stack Overflow but I haven't turned anything up that works for Windows. I feel like it ought to be a really simple function that I'm just missing.
-
Not sure why you want to, but have you tried <module>.__file__cmd– cmd2017-07-20 18:04:49 +00:00Commented Jul 20, 2017 at 18:04
-
Please look at SO's how to ask page before asking questions and follow what it says there. SO is not a website to tell you how to do this, rather you should attempt to code something, and when you receive an error or problem, present your code, an explanation, and the problem and we will help you figure out how to fix your issue.Professor_Joykill– Professor_Joykill2017-07-20 18:06:06 +00:00Commented Jul 20, 2017 at 18:06
-
Ok Professor_Joykill, well I'm here to learn, so would you explain to me what is wrong with the question? I have a program written out, but the context would hardly help the problem. It's a program that sends email notifications, and my boss requested that I try to find a way to get the module title into a variable to be sent in the email notification. Not knowing about the existence or use of a function doesn't produce an error code, so I'm failing to see what you would like me to add or remove from the question.Ravioli– Ravioli2017-07-22 03:04:55 +00:00Commented Jul 22, 2017 at 3:04
Add a comment
|