File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -23,21 +23,23 @@ int main(int argc, char *argv[])
2323 Py_NoUserSiteDirectory = 1 ;
2424 //Py_VerboseFlag += 1;
2525
26- Py_SetPythonHome (L"./" );
26+ /* Calculate absolute home dir */
27+ char cwd [PATH_MAX ];
28+ getcwd (cwd , sizeof (cwd ));
29+ /* Strip the leading sdmc: to workaround a bug somewhere... */
30+ char * stripped_cwd = strchr (cwd , '/' );
31+ if (stripped_cwd == NULL ) stripped_cwd = cwd ;
32+
33+ Py_SetPythonHome (Py_DecodeLocale (stripped_cwd , NULL ));
2734
2835 Py_Initialize ();
29-
36+
3037 /* Print some info */
3138 printf ("Python %s on %s\n" , Py_GetVersion (), Py_GetPlatform ());
3239
3340 /* set up import path */
34- char cwd [PATH_MAX ];
35- getcwd (cwd , sizeof (cwd ));
36- /* Strip the leading sdmc: to workaround a bug somewhere... */
37- char * stripped_cwd = strchr (cwd , '/' );
38- if (stripped_cwd == NULL ) stripped_cwd = cwd ;
3941 PyObject * sysPath = PySys_GetObject ("path" );
40- PyObject * path = PyUnicode_FromString (cwd );
42+ PyObject * path = PyUnicode_FromString (stripped_cwd );
4143 PyList_Insert (sysPath , 0 , path );
4244
4345 FILE * mainpy = fopen (MAINPY , "r" );
You can’t perform that action at this time.
0 commit comments