partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
250 stars 61 forks source link

Can not read data of file extension: ", name: undefined #164

Open mjones2620 opened 4 years ago

mjones2620 commented 4 years ago

Hi, I'm trying to use Kekule.IO.loadUrlData, but I keep on getting "Can not read data of file extension" error. I can confirm my API is returning the File as a .mol, as I am able to hit my API and download the file without issue.

Any ideas?

partridgejiang commented 4 years ago

Hi @mjones2620, is the server returns a wrong MIME type for .mol files that may mislead the loadUrlData? And could you please provide the URL string of the source mol file? Thanks a lot.

mjones2620 commented 4 years ago

I was able to work through that. Now I am getting "Unable to find a suitable renderer for object"

partridgejiang commented 4 years ago

Usually the object read from .mol is an instance of Kekule.Molecule, "Unable to find a suitable renderer for object" error seems to indicate that the data is not properly read and a wrong type object is obtained. Perhaps you could check the type in your code for further information, e.g.:

Kekule.IO.loadUrlData(url, function(chemObj, success){
  if (success && chemObj)
  {
    console.log(chemObj.getClassName());
  }
});

btw, it is also welcomed to upload your code and source mol files here, :).