Giter VIP home page Giter VIP logo

Comments (4)

dagewa avatar dagewa commented on August 30, 2024

Actually it seems like this is delegated back to a Reader object

>>> iset.reader()
<dxtbx.format.FormatMultiImage.Reader object at 0x0000025952A310F0>
>>> iset.reader()._filename
'c:\\dls\\mx\\data\\nt30330\\nt30330-15\\VMXi-AB1698\\well_42\\images\\image_58766.nxs'

from dxtbx.

dagewa avatar dagewa commented on August 30, 2024

Ok, where it goes wrong is here:

def resolve_path(path, directory=None):
"""Resolve a file path.
First expand any environment and user variables. Then create the absolute
path by applying the relative path to the provided directory, if necessary.
Args:
path (str): The path to resolve
directory (Optional[str]): The local path to resolve relative links
Returns:
str: The absolute path to the file to read
"""
if not path:
return ""
path = os.path.expanduser(os.path.expandvars(path))
if directory and not os.path.isabs(path):
path = os.path.join(directory, path)
return os.path.abspath(path)

On entry:

  • path is '/dls/mx/data/nt30330/nt30330-15/VMXi-AB1698/well_42/images/image_58766.nxs'
  • directory is 'c:\\Users\\fcx32934\\sw\\cctbx\\build\\dials_data\\dtpb_serial_processed'

Then os.path.join(directory, path) produces

'c:/dls/mx/data/nt30330/nt30330-15/VMXi-AB1698/well_42/images/image_58766.nxs'

Finally, os.path.abspath(path) escapes the path separators, resulting in

'c:\\dls\\mx\\data\\nt30330\\nt30330-15\\VMXi-AB1698\\well_42\\images\\image_58766.nxs'

from dxtbx.

dagewa avatar dagewa commented on August 30, 2024

Sorry, not quite right (I hate debugging on Windows).

It's just the action of os.path.abspath(path). The directory is irrelevant as the condition is False

In [5]: os.path.abspath(path)
Out[5]: 'c:\\dls\\mx\\data\\nt30330\\nt30330-15\\VMXi-AB1698\\well_42\\images\\image_58766.nxs'

from dxtbx.

dagewa avatar dagewa commented on August 30, 2024

What is the intended behaviour of resolve_path when it is passed a POSIX path on a Windows platform?

from dxtbx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.