Hello,
What's odd here is that it seems to be looking for the MolSystem using a
relative rather than an absolute path (which is why it then works if you
chdir into the project directory but not otherwise). It should always be
using an absolute path. I just tried replicating this problem with one of
my projects (including and not including chdir and validateProjectPath)
and cannot reproduce (which is how it ought to happen, since the paths in
my project are absolute). So my guess is that for your project
validateProjectPaths is failing somehow. (Because I cannot see that you
could ever get relative paths in your project XML file.)
Wayne
On Wed, 8 Aug 2007, gary thompson wrote:
> Dear all
> I have been trying to use the example code in python/examples/loadProject.py
> to load a ccpn project into memory independant of analysis. I have the
> following version that works
>
> from memops.general.Io import loadXmlProjectFile
> from memops.general.Io import getTopDirectory
> from memops.universal.Io import joinPath
> from memops.general.Io import validateProjectPaths
>
> if __name__ == "__main__":
>
> #
> # Load a CCPN project
> #
>
> projectDir = '/usr/torchwood/nmr/xxx/spectra/backbone'
> projectFileName = 'xxx_side_26_gst_viol_wim.xml'
>
> ccpnProject = loadXmlProjectFile(file = os.path.join
> (projectDir,projectFileName))
> os.chdir (projectDir)
>
> validateProjectPaths(ccpnProject)
>
>
> print "List of molSystem objects:", ccpnProject.sortedMolSystems()
> for molSys in ccpnProject.sortedMolSystems():
> print "MolSystem name:", molSys.name
> print "MolSystem code:", molSys.code
>
> however, if the os.chdir(projectDir) statement (which I added) isn't there i
> get the following error
>
> Traceback (most recent call last):
> File
> "/home/garyt/programs/ccpnmr/1.0.12/ccpnmr1.0/python/ccp/format/marvin/testMarvinAssignmentImport.py",
> line 80, in <module>
> print "List of molSystem objects:", ccpnProject.sortedMolSystems()
> File
> "/home/garyt/programs/ccpnmr/1.0.12/ccpnmr1.0/python/memops/api/Implementation.py",
> line 18526, in sortedMolSystems
> for obj in self.molSystems:
> File
> "/home/garyt/programs/ccpnmr/1.0.12/ccpnmr1.0/python/memops/api/Implementation.py",
> line 12456, in getMolSystems
> otherStorage.load()
> File
> "/home/garyt/programs/ccpnmr/1.0.12/ccpnmr1.0/python/memops/api/Implementation.py",
> line 9054, in load
> stream = self.url.getStream(self.package, path=self.path, headObject=
> self.project)
> File
> "/home/garyt/programs/ccpnmr/1.0.12/ccpnmr1.0/python/memops/general/Implementation.py",
> line 525, in getStream
> raise ApiError(str(e))
> memops.general.Implementation.ApiError: [Errno 2] No such file or directory:
> 'xxx_side_26_gst_viol_wim/ccp/MolSystem.xml'
>
>
> help ;-)
>
>
> regards
> gary
>
|