From 667ec7c25a549ee0bee476039219e1ff1a3e93cc Mon Sep 17 00:00:00 2001
From: Tobias Schmidt <tobias.schmidt@unibas.ch>
Date: Thu, 28 Jun 2012 17:27:13 +0200
Subject: [PATCH] improve warning when using LoadPDB incorrectly

---
 modules/io/pymod/__init__.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/io/pymod/__init__.py b/modules/io/pymod/__init__.py
index aeb29423d..0d6d0e142 100644
--- a/modules/io/pymod/__init__.py
+++ b/modules/io/pymod/__init__.py
@@ -137,8 +137,11 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None,
       return val1
   if isinstance(profile, str):
     prof=profiles[profile].Copy()
-  else:
+  elif isinstance(profile, IOProfile):
     prof=profile.Copy()
+  else:
+    raise TypeError('profile must be of type string or IOProfile, '+\
+                    'instead of %s'%type(profile))
   if dialect not in (None, 'PDB', 'CHARMM',):
     raise ValueError('dialect must be PDB or CHARMM')
   prof.calpha_only=_override(prof.calpha_only, calpha_only)
@@ -208,8 +211,11 @@ def SavePDB(models, filename, dialect=None,  pqr=False, profile='DEFAULT'):
     models=[models]
   if isinstance(profile, str):
     profile=profiles[profile].Copy()
-  else:
+  elif isinstance(profile, IOProfile):
     profile.Copy()
+  else:
+    raise TypeError('profile must be of type string or IOProfile, '+\
+                    'instead of %s'%type(profile))
   profile.dialect=_override(profile.dialect, dialect)
   writer=PDBWriter(filename, profile)
   writer.SetIsPQR(pqr)
-- 
GitLab