You can try the attached patch. It fixes three issues:

* is_string() returns False in case of unicode filenames
* Python/Tk bug http://bugs.python.org/issue5712
* filenames containing whitespace

Christoph

On 1/23/2011 7:02 AM, wang_qi wrote:
Hello, everyone,
I have downloaded the pymol of version 1.3. and installed it on windows
XP successfully. But when selecting "file-open" to load my file, it
doesn't work and displays that the file is unable to be opend. Dose
anyone meet this problem? Ana how how can i solve it?
Thanks.
Qi Wang
2011-01-23
wang_qi




Index: pymol/modules/pymol/commanding.py
===================================================================
--- pymol/modules/pymol/commanding.py   (revision 3896)
+++ pymol/modules/pymol/commanding.py   (working copy)
@@ -89,7 +89,8 @@
     
         '''
         pymol=_self._pymol
-        if not is_string(filename): # we're logging to Queue, not a file.
+        # CG: is_string returns False in case of unicode filenames
+        if not isinstance(filename, basestring): # we're logging to Queue, not 
a file.
             pymol._log_file = QueueFile(filename)
             _self.set("logging",1,quiet=1)
         else:
Index: pymol/modules/pmg_tk/skins/demo/__init__.py
===================================================================
--- pymol/modules/pmg_tk/skins/demo/__init__.py (revision 3896)
+++ pymol/modules/pmg_tk/skins/demo/__init__.py (working copy)
@@ -19,6 +19,8 @@
         ofile_list = askopenfilename(initialdir = self.fileOpenPath,
                                      filetypes=self.app.getLoadableFileTypes(),
                                      multiple=1) 
+        # CG: work around Python/Tk bug http://bugs.python.org/issue5712
+        if isinstance(ofile_list, basestring): ofile_list = [ofile_list]
         for ofile in ofile_list:
             if len(ofile):
                 self.fileOpenPath = os.path.dirname(ofile)
Index: pymol/modules/pmg_tk/skins/normal/__init__.py
===================================================================
--- pymol/modules/pmg_tk/skins/normal/__init__.py       (revision 3896)
+++ pymol/modules/pmg_tk/skins/normal/__init__.py       (working copy)
@@ -538,11 +538,15 @@
             ofile_list = askopenfilename(initialdir = initdir,
                                          filetypes=ftypes,
                                          multiple=1) # new option in Tk 8.4
+            # CG: work around Python/Tk bug http://bugs.python.org/issue5712
+            if isinstance(ofile_list, basestring): ofile_list = [ofile_list]
         else:
             ofile_list = [ askopenfilename(initialdir = initdir,
                                          filetypes=ftypes) ]
         for ofile in ofile_list:
             if len(ofile):
+                # CG: filenames containing whitespace
+                if ofile.startswith('{'): ofile = ofile[1:-1]
                 if not tutorial:
                     self.initialdir = re.sub(r"[^\/\\]*$","",ofile)
                 try:
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
PyMOL-users mailing list ([email protected])
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/[email protected]

Reply via email to