Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#3477 closed defect (not a bug)

file names with spaces

Reported by: tony.schaefer@… Owned by: Eric Pettersen
Priority: normal Milestone:
Component: Input/Output Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Windows-10-10.0.17763
ChimeraX Version: 1.1.dev202007022309 (2020-07-02 23:09:11 UTC)
Description
the open command gives a 'no such database' error when I give it an absolute path on another hard drive and the filename has spaces

It works fine if I click the file on the 'Recent' view or with the File -> Open method. If I copy+paste the command on the log I get the error. If I click the command on the log (executable command links) it does work. 

Log:
Startup Errors  
---  
error | Bundle 'ChimeraX-Registration' custom initialization failed  
warning | Traceback (most recent call last):  
File "D:\ChimeraX 1.1.dev202007022309\bin\lib\site-
packages\chimerax\core\toolshed\info.py", line 342, in initialize  
api._api_caller.initialize(api, session, self)  
File "D:\ChimeraX 1.1.dev202007022309\bin\lib\site-
packages\chimerax\core\toolshed\\__init__.py", line 1599, in initialize  
return cls._get_func(api, "initialize")(session, bi)  
File "D:\ChimeraX 1.1.dev202007022309\bin\lib\site-
packages\chimerax\registration\\__init__.py", line 41, in initialize  
nag(session)  
File "D:\ChimeraX 1.1.dev202007022309\bin\lib\site-
packages\chimerax\registration\nag.py", line 32, in nag  
if not check_registration(logger=session.logger):  
File "D:\ChimeraX 1.1.dev202007022309\bin\lib\site-
packages\chimerax\registration\nag.py", line 54, in check_registration  
return _check_expiration(param, logger)  
File "D:\ChimeraX 1.1.dev202007022309\bin\lib\site-
packages\chimerax\registration\nag.py", line 136, in _check_expiration  
expires = _expiration_time(param)  
File "D:\ChimeraX 1.1.dev202007022309\bin\lib\site-
packages\chimerax\registration\nag.py", line 157, in _expiration_time  
locale.setlocale(locale.LC_TIME, "en_US.UTF-8")  
File "D:\ChimeraX 1.1.dev202007022309\bin\lib\locale.py", line 608, in
setlocale  
return _setlocale(category, locale)  
locale.Error: unsupported locale setting  
  

> cd "C:\Users\Tony Schaefer/Desktop"

Current working directory is: C:\Users\Tony Schaefer\Desktop  
UCSF ChimeraX version: 1.1.dev202007022309 (2020-07-02)  
© 2016-2020 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  

> open "D:\SEQCROW_SCRATCH\phenol Wed Jul 1 19.15.55 2020\phenol.out" format
> out coordsets true

Opened D:\SEQCROW_SCRATCH\phenol Wed Jul 1 19.15.55 2020\phenol.out as a ORCA
output file movie  
No such database 'D'  

> help open

> pwd

Current working directory is: C:\Users\Tony Schaefer\Desktop  

> open "D:/SEQCROW_SCRATCH/phenol Wed Jul 1 19.15.55 2020/phenol.out"

Opened D:/SEQCROW_SCRATCH/phenol Wed Jul 1 19.15.55 2020/phenol.out as a ORCA
output file  

> open
> https://raw.githubusercontent.com/QChASM/AaronTools.py/master/Substituents/26-F-Ph.xyz
> dataFormat xyz

Summary of feedback from opening
//raw.githubusercontent.com/QChASM/AaronTools.py/master/Substituents/26-F-Ph.xyz
fetched from https  
---  
notes | Fetching compressed 26-F-Ph.xyz from
https://raw.githubusercontent.com/QChASM/AaronTools.py/master/Substituents/26-F-Ph.xyz  
Downloaded 26-F-Ph.xyz to C:\Users\Tony Schaefer\Downloads\26-F-Ph.xyz  
  
Opened C:\Users\Tony Schaefer\Downloads\26-F-Ph.xyz as a XYZ file  

> open "C:/Users/Tony Schaefer/Desktop/asdf.xyz"

Opened C:/Users/Tony Schaefer/Desktop/asdf.xyz as a XYZ file  

> open "C:/Users/Tony Schaefer/Desktop/asdf.xyz"

Opened C:/Users/Tony Schaefer/Desktop/asdf.xyz as a XYZ file  

> open "C:/Users/Tony Schaefer/Desktop/phenol test.xyz"

Opened C:/Users/Tony Schaefer/Desktop/phenol test.xyz as a XYZ file  

> open D:SEQCROW_SCRATCH/asdf.xyz

Opened D:SEQCROW_SCRATCH/asdf.xyz as a XYZ file  
No such database 'D'  

> open "C:/Users/Tony Schaefer/Desktop/phenol test.xyz"

Opened C:/Users/Tony Schaefer/Desktop/phenol test.xyz as a XYZ file  

> open "D:/SEQCROW_SCRATCH/phenol Wed Jul 1 19.15.55 2020/phenol.xyz"

Opened D:/SEQCROW_SCRATCH/phenol Wed Jul 1 19.15.55 2020/phenol.xyz as a XYZ
file  
No such database 'D'  

> ui tool show Shell

> D:/SEQCROW_SCRATCH/phenol Wed Jul 1 19.15.55 2020/phenol.xyz

> ui tool show "Build QM Input"

> help open

> open smiles:C

Translated SMILES to 3D structure via NCI web service (SMILES: C)  

> hide #1 models

> hide #2 models

> hide #!4 models

> hide #3 models

> hide #!5 models

> hide #9 models

> hide #8 models

> hide #!7 models

> hide #6 models

adding test open to queue  
job started: local ORCA job "test open"  

> ui tool show "Job Queue"

job finished: local ORCA job "test open"  

> open "D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out"
> coordsets true

Summary of feedback from opening D:\SEQCROW_SCRATCH\test open Fri Jul 3
13.32.13 2020\test_open.out  
---  
note | C:\Users\Tony Schaefer\AppData\Local\UCSF\ChimeraX\1.1\site-
packages\SEQCROW\io.py:40: UserWarning: energy plot could not be opened  
there might be a mismatch between energy entries and structure entries in
D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out  
"there might be a mismatch between energy entries and structure entries in %s"
% path)  
  
Opened D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out as a
ORCA output file movie  

> ui tool show Shell

No such database 'D'  

> open "D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out"
> coordsets true

Summary of feedback from opening D:\SEQCROW_SCRATCH\test open Fri Jul 3
13.32.13 2020\test_open.out  
---  
note | C:\Users\Tony Schaefer\AppData\Local\UCSF\ChimeraX\1.1\site-
packages\SEQCROW\io.py:40: UserWarning: energy plot could not be opened  
there might be a mismatch between energy entries and structure entries in
D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out  
"there might be a mismatch between energy entries and structure entries in %s"
% path)  
  
Opened D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out as a
ORCA output file movie  

> open "D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out"
> coordsets true

Opened D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out as a
ORCA output file movie  

> open "D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out"
> coordsets true

Opened D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out as a
ORCA output file movie  

> open "D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out"
> coordsets true

Opened D:\SEQCROW_SCRATCH\test open Fri Jul 3 13.32.13 2020\test_open.out as a
ORCA output file movie  
No such database 'D'  




OpenGL version: 3.3.0 NVIDIA 445.75
OpenGL renderer: GeForce RTX 2070/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation
Manufacturer: To Be Filled By O.E.M.
Model: To Be Filled By O.E.M.
OS: Microsoft Windows 10 Education (Build 17763)
Memory: 17,107,533,824
MaxProcessMemory: 137,438,953,344
CPU: 16 AMD Ryzen 7 2700X Eight-Core Processor         "
PyQt version: 5.12.3
Compiled Qt version: 5.12.4
Runtime Qt version: 5.12.9

Change History (15)

comment:1 by Eric Pettersen, 5 years ago

Component: UnassignedInput/Output
Owner: set to Eric Pettersen
Platform: all
Project: ChimeraX
Status: newaccepted
Summary: ChimeraX bug report submissionNever interpret (single-letter): as database

comment:2 by Eric Pettersen, 5 years ago

Resolution: not a bug
Status: acceptedclosed
Summary: Never interpret (single-letter): as databasefile names with spaces

File names with spaces require quotes around them in an "open" command. When I open such a file using File→Open, the logged command has the proper spaces. Are you saying that somehow a command got logged (that you then copy/pasted) that had no quotes?

--Eric

in reply to:  3 ; comment:3 by tony.schaefer@…, 5 years ago

The logged commands have quotes. I've just done some more testing, and I'm less sure of what causes the error.

I tried opening a file at "D:/SEQCROW_SCRATCH/ti complex Mon Jul 6 23.23.56 2020/ti_complex.out" using File -> Open. This worked.

I tried clicking on the command in the log with executable command links (open "D:/SEQCROW_SCRATCH/ti complex Mon Jul 6 23.23.56 2020/ti_complex.out"). This worked.

I tried pasting `open "D:/SEQCROW_SCRATCH/ti complex Mon Jul 6 23.23.56 2020/ti_complex.out"` into the command line (copied from the log with ctrl+c, ctrl+v). This did not work, giving the "no such database: 'D'" error. I get the same result when I manually type out the command.

I copied the file to "D:/SEQCROW_SCRATCH/there is a space and a.period/ti_complex.out". I tried entering the command `open "D:/SEQCROW_SCRATCH/there is a space and a.period/ti_complex.out"`. This worked.

I've also tried opening the shell and checking os.path.exists("D:/SEQCROW_SCRATCH/ti complex Mon Jul 6 23.23.56 2020/ti_complex.out"). It returns False. However, os.path.exists("D:\\SEQCROW_SCRATCH\\ti complex Mon Jul 6 23.23.56 2020\\ti_complex.out") and os.path.exists("D:/SEQCROW_SCRATCH/there is a space and a.period/ti_complex.out") both return True. I don't know why os.path is fine with some of these filenames but not others. Escaping the windows file system separators on the command line like I did with os.path.exists doesn't help.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Wednesday, July 15, 2020 2:38 PM
Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; Anthony James Schaefer <tony.schaefer@uga.edu>
Subject: Re: [ChimeraX] #3477: file names with spaces (was: Never interpret (single-letter): as database)

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


#3477: file names with spaces
--------------------------------------+----------------------------
          Reporter:  tony.schaefer@…  |      Owner:  Eric Pettersen
              Type:  defect           |     Status:  closed
          Priority:  normal           |  Milestone:
         Component:  Input/Output     |    Version:
        Resolution:  not a bug        |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+----------------------------
Changes (by Eric Pettersen):

 * status:  accepted => closed
 * resolution:   => not a bug


Comment:

 File names with spaces require quotes around them in an "open" command.
 When I open such a file using File→Open, the logged command has the proper
 spaces.  Are you saying that somehow a command got logged (that you then
 copy/pasted) that had no quotes?

 --Eric

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/3477#comment:2>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:4 by Greg Couch, 5 years ago

I was not able to reproduce this on my Windows system. This might be a Qt bug. We updated Qt from 5.12.8 to 5.12.9 the day you downloaded ChimeraX. Please download a new version and see if it fixes the problem for you.

in reply to:  5 ; comment:5 by tony.schaefer@…, 5 years ago

It's working properly in the latest daily build, thanks!
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Wednesday, July 15, 2020 4:33 PM
Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; Anthony James Schaefer <tony.schaefer@uga.edu>
Subject: Re: [ChimeraX] #3477: file names with spaces

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


#3477: file names with spaces
--------------------------------------+----------------------------
          Reporter:  tony.schaefer@…  |      Owner:  Eric Pettersen
              Type:  defect           |     Status:  closed
          Priority:  normal           |  Milestone:
         Component:  Input/Output     |    Version:
        Resolution:  not a bug        |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+----------------------------

Comment (by Greg Couch):

 I was not able to reproduce this on my Windows system.  This might be a Qt
 bug.  We updated Qt from 5.12.8 to 5.12.9 the day you downloaded ChimeraX.
 Please download a new version and see if it fixes the problem for you.

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/3477#comment:4>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:6 by Tom Goddard, 5 years ago

I also tested on Windows in ChimeraX July 13 version and the following returned true

os.path.exists("D:/SEQCROW_SCRATCH/ti complex Mon Jul 6 23.23.56 2020/ti_complex.out")
-> True

as expected. And using Chimera command open "D:/SEQCROW_SCRATCH/ti complex Mon Jul 6 23.23.56 2020/ti_complex.out" said "suffix .out unknown" as expected.

I then copied and pasted this open command from the log into the command-line, and again it gave the expected "suffix .out unknown".

How is it that Tony's log says the following? It seems it opened the file and also gave the no database D error.

open "D:\SEQCROW_SCRATCH\phenol Wed Jul 1 19.15.55 2020\phenol.out" format out coordsets true

Opened D:\SEQCROW_SCRATCH\phenol Wed Jul 1 19.15.55 2020\phenol.out as a ORCA
output file movie
No such database 'D'

I think Tony's ".out" file reader is goofed up somehow.

comment:7 by Eric Pettersen, 5 years ago

I think the there is a problematic command between the "Opened..." line and the "No such database..." line that isn't echoed in the log, at least not the plain-text version we receive. That's my best guess.

in reply to:  8 ; comment:8 by tony.schaefer@…, 5 years ago

The open command I paste into the command line that results in the 'no such database' error didn't ever get echoed. The previous open command was from File -> Open.

Here's the log after I repeated enter `open d:test` several times:

No such database 'd'
No such database 'd'
No such database 'd'
No such database 'd'
No such database 'd'
No such database 'd'
No such database 'd'
No such database 'd'
No such database 'd'

The open command is not echoed, but the error is printed.

What could be wrong with my file opener that would result in a 'no such database' error only some of the time? I believe I have constructed my IO in a manner consistent with the sample bundle in the tutorial (https://www.cgl.ucsf.edu/chimerax/docs/devel/tutorials/tutorial_read_format.html). I have the provider-manager info specified in my bundle_info XML file, as well as the old DataFormat. The DataFormat hasn't been an issue, but I'll remove it if it's problematic. I do not raise any database errors, nor do I have any 3rd party bundles installed that use databases.

I assumed it was more closely related to os.path.exists returning False for that file due to how the command line interpreted the string. I doubt ChimeraX would have tried to load something from a database if the filename exists, so I'd be surprised if my code was even invoked.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Wednesday, July 15, 2020 6:03 PM
Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; Anthony James Schaefer <tony.schaefer@uga.edu>
Subject: Re: [ChimeraX] #3477: file names with spaces

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


#3477: file names with spaces
--------------------------------------+----------------------------
          Reporter:  tony.schaefer@…  |      Owner:  Eric Pettersen
              Type:  defect           |     Status:  closed
          Priority:  normal           |  Milestone:
         Component:  Input/Output     |    Version:
        Resolution:  not a bug        |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+----------------------------

Comment (by Eric Pettersen):

 I think the there is a problematic command between the "Opened..." line
 and the "No such database..." line that isn't echoed in the log, at least
 not the plain-text version we receive.  That's my best guess.

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/3477#comment:7>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:9 by Eric Pettersen, 5 years ago

If you try to open something1:something2 and something1:something2 exists on the file system then it will open that file. If it doesn't exist, it will interpret something1 as a database name and try to fetch something2 from it.

Yes, it looks like a command that results in an actual error dialog does not get echoed to the log. I need to fix that.

I intend to improve the code to disallow single-letter database names (and resulting confusion with drive letters) but haven't gotten to it yet.

comment:10 by Eric Pettersen, 5 years ago

I believe that when the "No such database" error occurs, your code hasn't been called at all.

comment:11 by Eric Pettersen, 5 years ago

Well, if os.path.exists() return False for a file that does in fact exist, then that is the problem. Though I thought you said things were working okay in the latest daily build...

comment:12 by Eric Pettersen, 5 years ago

Starting with tomorrow's build, failed commands will be echoed to the log.

in reply to:  13 ; comment:13 by tony.schaefer@…, 5 years ago

os.path.exists returns the expected result in the daily build I installed just today. Earlier today, I was not using the latest daily build. For my example in comment 3 (not using latest daily build), I had to use Windows file system separators (\\) in order to get os.path.exists to return True for one file path. Using '/' instead returned False. I do not recall which ChimeraX build I was using or what version of Python it was.

I am having the os.path.exists issue with my system python (Anaconda Python 3.7.4), though the need to escape the separators seems to only apply to certain separators (ones next to 'n' or 't'). Perhaps this behavior varies in other distributions or python versions, but it is working as expected in ChimeraX's python.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Wednesday, July 15, 2020 7:02 PM
Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; Anthony James Schaefer <tony.schaefer@uga.edu>
Subject: Re: [ChimeraX] #3477: file names with spaces

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


#3477: file names with spaces
--------------------------------------+----------------------------
          Reporter:  tony.schaefer@…  |      Owner:  Eric Pettersen
              Type:  defect           |     Status:  closed
          Priority:  normal           |  Milestone:
         Component:  Input/Output     |    Version:
        Resolution:  not a bug        |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+----------------------------

Comment (by Eric Pettersen):

 Well, if os.path.exists() return False for a file that does in fact exist,
 then that is the problem.  Though I thought you said things were working
 okay in the latest daily build...

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/3477#comment:11>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:14 by Eric Pettersen, 5 years ago

Python interprets \r and \t as carriage return and tab respectively, as well as a few others (e.g. \n as newline). You can either use double backslashes or prefix the string with 'r' ("raw" string), e.g. r'\trna'.

in reply to:  15 ; comment:15 by tony.schaefer@…, 5 years ago

yes, with comment 3 I wanted to point out that while I could write a literal string such that os.path.exists returns True, the same string or one with un-escaped backslashes or forward slashes did not work on the command line for the old version of ChimeraX I was using. Things are working as expected in the latest daily build of ChimeraX.

I forget if I was using raw strings when I punched the code into my system python. I may have confused that with different escape behavior.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Wednesday, July 15, 2020 7:20 PM
Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; Anthony James Schaefer <tony.schaefer@uga.edu>
Subject: Re: [ChimeraX] #3477: file names with spaces

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


#3477: file names with spaces
--------------------------------------+----------------------------
          Reporter:  tony.schaefer@…  |      Owner:  Eric Pettersen
              Type:  defect           |     Status:  closed
          Priority:  normal           |  Milestone:
         Component:  Input/Output     |    Version:
        Resolution:  not a bug        |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+----------------------------

Comment (by Eric Pettersen):

 Python interprets \r and \t as carriage return and tab respectively, as
 well as a few others (e.g. \n as newline).  You can either use double
 backslashes or prefix the string with 'r' ("raw" string), e.g. r'\trna'.

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/3477#comment:14>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker
Note: See TracTickets for help on using tickets.