Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AttributeError: 'module' object has no attribute 'argv'
- #include "stdafx.h"
- #include "C:/Python27/include/Python.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- Py_Initialize();
- PyRun_SimpleString("import sysnprint sys.argv[0]");
- }
- import sys
- print sys.argv[0]
- int main(int argc, char **argv)
- {
- Py_Initialize();
- PySys_SetArgv(argc, argv);
- PyRun_SimpleString("import sysnprint sys.argv");
- }
- localhost-2:argv $ ./a.out
- ['./a.out']
- localhost-2:argv $ ./a.out arg0 17
- ['./a.out', 'arg0', '17']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement