Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffpython::add_path() file path changed support #8

Closed
lion117 opened this issue Mar 31, 2015 · 0 comments
Closed

ffpython::add_path() file path changed support #8

lion117 opened this issue Mar 31, 2015 · 0 comments

Comments

@lion117
Copy link

lion117 commented Mar 31, 2015

issue have been solve . it belong to my python file which could not load files

hi fanchy
ffpython add specified file path by use add_path() or run_string to do this work .
after view the source code : the mechanism to load module in python is :

char buff[1024];
        SAFE_SPRINTF(buff, sizeof(buff), "import sys\nif '%s' not in 
sys.path:\n\tsys.path.append('%s')\n", path_.c_str(), path_.c_str());
        PyRun_SimpleString(buff);

but in the mixed programming , python files maybe located in several directory . once i use the add-path () , it seems the library didnot support to change the specified file path any more .
like following code :

{   ffpython_t  I_pythoner;
    ffpython_t::add_path("./py_file/");
    i_pythoner.call<void>("test_module", "sayhi");      
   # ffpython_t::add_path("./child_dir/");                     
    #i_pythoner.call<void>("test_module2", "sayhi");       # could not  find the module 
}

current directory
----py_file
--------test_module.py
--------child_dir
------------test_module.py

question

could ffpython support multiple - paths module loading ? if it could , what do i supposed to do ?

@lion117 lion117 closed this as completed Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant