laura.c Posted November 25, 2015 Report Share Posted November 25, 2015 Hi guys, I need to use ftrack in VisualStudio 2012. Unfortunately, I always get "Attempted relative import in non-package" when trying to import ftrack. With SetSearchPaths() I set the path to python-api location as "......../python-api/". Is there anything else I need to define in order to import ftrack? thank you,Laura Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted December 4, 2015 Report Share Posted December 4, 2015 Hi Laura, I'm not familiar with VisualStudio. Is this for getting autocompletion to work or is it when debugging, running your code from Visual studio? Please elaborate and perhaps I can help you better Link to comment Share on other sites More sharing options...
laura.c Posted January 11, 2016 Author Report Share Posted January 11, 2016 Hi Mattias, Thanks for your answer. I am testing it in a very simple way, in Visual Studio 13, interactive windows: Python 64-bit 2.7: it works IronPython 2.7: I get :>>> import sys>>> sys.path.insert(0,<FtrackPythonApiPath>)>>> sys.path.insert(0,<FtrackPythonApiPath>\FTrackCore)>>> sys.path.insert(0,<FtrackPythonApiPath>\api)>>> import ftrackTraceback (most recent call last): File "<string>", line 1, in <module> File "<FtrackPythonApiPath>\ftrack.py", line 20, in <module> from FTrackCore import * File "<FtrackPythonApiPath>\FTrackCore\__init__.py", line 8, in <module> from .api.client import * File "<FtrackPythonApiPath>\FTrackCore\api\client.py", line 22, in <module> from group import Group, getGroups File "<FtrackPythonApiPath>\FTrackCore\api\group.py", line 4, in <module> from .ftobject import FTObjectValueError: Attempted relative import in non-packageDo I need to add some other paths or to import some modules? Thanks. Best,Laura Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted January 12, 2016 Report Share Posted January 12, 2016 Hi Laura, I'm sorry but I cannot give any advice regarding IronPython. A quick google shows that there are others experiencing issues with relative imports in IronPython Link to comment Share on other sites More sharing options...
Martin Pengelly-Phillips Posted January 12, 2016 Report Share Posted January 12, 2016 Hi Laura, I think the issue may be that you are adding internal package paths to sys.path. Try just setting onlysys.path.insert(0,<FtrackPythonApiPath>)and notsys.path.insert(0,<FtrackPythonApiPath>\FTrackCore)sys.path.insert(0,<FtrackPythonApiPath>\api)Martin Link to comment Share on other sites More sharing options...
laura.c Posted January 12, 2016 Author Report Share Posted January 12, 2016 Hi Martin, already tried and I getTraceback (most recent call last): File "<string>", line 1, in <module> File "<FtrackPythonApiPath>\ftrack.py", line 20, in <module> from FTrackCore import * File "<FtrackPythonApiPath>\FTrackCore\__init__.py", line 8, in <module> from .api.client import * File "<FtrackPythonApiPath>\FTrackCore\api\client.py", line 22, in <module> from group import Group, getGroupsImportError: No module named groupThat's why I added the location for "group" module: <FtrackPythonApiPath>\FTrackCore\api. Laura Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.