sys.argv[0] - 'module' object has no attribute 'argv'

sys.argv[0] - 'module' object has no attribute 'argv'

Post by thomas.nue » Tue, 01 Jul 2003 23:07:27


Hi!

I have the following problem within a program, that is using the
python dll. With this program i want to use Tkinter, but after setting
all paths i get the following error:

Traceback (most recent call last):
File "c:/mtt/bg_private_area/truefalsetest.py", line 32 in ?
ListSelection(datal)

File "C:\Prog1\MttDialogs.py", line 324 in ListSelection
root = Tk()

File "C:\Prog1\lib\lib-tk\Tkinter.py", line 1491, in __init__
baseName = os.path.basename(sys.argv[0])

AttributeError: 'module' object has no attribute 'argv'
Redirected about to stop, stderr

sys and os are internal modules i didn't touch - so i think it must be
a problem of the configuration of Python or the corresponding
compilation.
It would be great if somebody could help me with this problem!

Thomas
 
 
 

1. char** argv versus char *argv[]

2. Why argv[i][j] modifiable?, argv[0] = something, again


Pardon my ignorance, but *why* is it a good thing to prohibit the
implementation from passing the program arguments as literals?
You seem to be saying that there's a good rationale for requiring
argv[i][j] to be modifiable; what is that rationale?

David Tribble points out that this requirement complicates recursive
calls to 'main'; I imagine it might complicate the startup code on some
implementations, too. So, what's the "good case" that makes all this
complication worthwhile?

-Arthur
(I checked the Rationale, and didn't see anything relevant.)

3. difference(s) between char** argv and char* argv[]

4. int main(int argc, char *argv[] ) vs int main(int argc, char **argv )

5. char **argv & char *argv[]

6. char **argv vs. char* argv[]

7. int main(int argc, char *argv[] ) vs int main(int argc, char **argv )

8. int main(int argc, char* argv[]) & int main(int argc, char** argv)

9. [OT] char **argv vs. char* argv[]

10. [FAQ] difference(s) between char** argv and char* argv[]

11. sys.argv[0] doesn't always contain the full path of running script.

12. C API: getting sys.argv

13. execute shell script from python, needs sys.argv

14. What encoding is used when initializing sys.argv?

15. sys.argv index out of range error