Home Help Center

slice2py - Access outside generated folder

NotQuiteNotQuite Member Ryan CarpenterOrganization: PersonalProject: game client/server communication
Python 2.7.6 development with Ice 3.5:

My 'package' structure looks something like this, I'm excluding listing most __init__ files from below:
lib+
messaging+
manager.py <-- This file includes access to the generated ice file
manager-dev.py <-- This file is for development
network+
manager.ice
manager+ <--generated
__init__.py <--generated
manager_ice.py <--generated

It doesn't seem to matter whether or not I use the 'package' directive in the slice file, unless manager-dev.py is in the same folder as manager_ice.py I get import errors. This is unacceptable for python development. Is there something I'm missing here? How can I access the generated files from another folder?

On a side note, it seems strange to me that you would generate a 'module' but then not include the generated file within that module but include it as the same level. Also, I may have other things in my __init__ files, if I use the package directive in the slice file do I have to manually add the generated __init__ elements to my current __init__ files? What if I have more than one slice file? I'm a bit confused about how this is supposed to work effectively. I hope I'm just missing something.

My slice folder looks something like this:
"python:package:lib.network" <-- I've tried it with and without the package
module manager
{
interface MessageManager
{
void func();
};
};

Comments

  • NotQuiteNotQuite Member Ryan CarpenterOrganization: PersonalProject: game client/server communication
    I've found a temporary work around. If I move my slice generated files to the root folder, above 'lib'. It seems I can then import from anywhere below that point without any issues. While this works, it's quite messy as all the generated folders sit at the same level as my main executable script. It would be great if I could actually include these generated files in my package and be able to refer to them correctly(pythonicly speaking of course).

    I would still love a more permanent solution to this issue. Thanks!
Sign In or Register to comment.