Skip to main content
cameronmcefee
Inspiring
May 31, 2018
Answered

"Cannot convert" error using evalFile

  • May 31, 2018
  • 1 reply
  • 3053 views

Hello!

I've run into a difficult to diagnose bug with an ambiguous error, that I'm hoping someone here might understand.


var result = $.evalFile(Folder('C:/Program Files (x86)/Common Files/Adobe/CEP/extensions/me.guideguide.adobeextension/host.js').fsName)

This line throws an error that is simply "Cannot convert". I assume that since it throws an error rather than returns one, that the problem is with evaluating the file and not with the code within the file.

Details:

- Only appears to happen in Asia, most commonly in China, judging by the localized errors.

- Only appears on Windows

- Does not appear in US/EU versions

- The forward slashes and spaces are produced by CSInterface.getSystemPath. I've ruled them out as the cause because there is no issue in US/EU versions.

My best guess is that it's either an encoding or a line-ending issue, but I can't find any documentation that talks about either topic related to $.evalFile

If anyone knows more specifically what "cannot convert" means, I and a number of users in Asia would love to know.

This topic has been closed for replies.
Correct answer cameronmcefee

No luck, I'm still getting the error. I've got a few versions out in the wild to test multiple theories:

 

- I have one that includes the .jsx via the manifest file, in hopes of ruling out issues related to $.evalFile. I haven't heard back from this user yet and may need to just release it to genpop to see what happens.

 

- The current version has broken up the .jsx file into two files now, one with polyfills and one that loads my APIs, in hopes of determining whether it's the file contents, and if so, if it's a polyfill issue, or APIs.

 

I've also increased my error tracking quite a bit (I use Sentry), and future errors will have getHostEnvironment data attached so I can see if there's a common CC version between the errors. I've also done tests on my own to try to determine whether the error is from the evaluation or the file contents. If I throw an error in the file, I get a stack trace from the file, whereas the errors I get from production versions give me a stack trace from the $.evalFile line, so I'm still pretty convinced it's related to the eval and not the file contents.


The bug has been resolved. I never did confirm the actual cause, but I fixed it by changing the strategy. Instead of using evalFile, I now read the file contents, which lets me set the encoding, and then I use evalScript on that.

1 reply

SuperMerlin
Inspiring
May 31, 2018

I maybe way off but it does not look right.

$.evalFile(Folder

should it not be

$.evalFile(File

cameronmcefee
Inspiring
May 31, 2018

It's probably worth me changing that, but this does fall within the "It works in US/EU versions" bucket. I wouldn't expect that to make a regional difference. The Folder part is a recent addition to try to rule out the slashes being an issue. This also has the problem:

var result = $.evalFile('C:/Program Files (x86)/Common Files/Adobe/CEP/extensions/me.guideguide.adobeextension/host.js') 
SuperMerlin
Inspiring
May 31, 2018

That does work for me, so can't help as I don't have any other language version.

Best of luck.

Maybe if r-bin​ is about he might point you in the right direction?