question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`dm.read_smi()` copies a file to an already existing location

See original GitHub issue

When I try to load a remote .smi file using Datamol, I run into the following exception:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
(...)

File ~/mambaforge/envs/mood/lib/python3.10/site-packages/datamol/io.py:320, in read_smi(urlpath)
    318 if not fsspec.utils.can_be_local(str(urlpath)):
    319     active_path = pathlib.Path(tempfile.mkstemp()[1])
--> 320     dm.utils.fs.copy_file(urlpath, active_path)
    322 # Read the molecules
    323 supplier = rdmolfiles.SmilesMolSupplier(str(active_path), titleLine=0)

File ~/mambaforge/envs/mood/lib/python3.10/site-packages/datamol/utils/fs.py:250, in copy_file(source, destination, chunk_size, force, progress, leave_progress)
    247     raise ValueError(f"The file being copied does not exist or is not a file: {source}")
    249 if not force and is_file(destination_file):  # type: ignore
--> 250     raise ValueError(f"The destination file to copy already exists: {destination}")
    252 with source_file as source_stream:
    253     with destination_file as destination_stream:

ValueError: The destination file to copy already exists: /tmp/tmpkzrm7u58

Seems like this function is not up-to-date with recent changes in the dm.utils.fs module? Seems to me like active_path should be set differently to a non-existing file.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hadimcommented, Nov 11, 2022

Yes I remember hesitating doing that at the very beginning of datamol but I prefer to stick to rdkit here in case the rdkit function is modified. If a user use read_smi he will expect the equivalent rdkit function under the hood.

1reaction
hadimcommented, Nov 11, 2022

Yes. There is nothing specific to .smi. It’s just a csv-like format.

Read more comments on GitHub >

github_iconTop Results From Across the Web

init/README.md
An example is the userdebug logcatd.rc and Android.mk files located in the system/core/logcat directory. The LOCAL_INIT_RC macro in the Android.mk file ...
Read more >
fscrypt/README.md at master - GitHub
There are only a few cases where copying files into an encrypted directory can really make sense, such as: The source files are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found