• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

"Cannot convert" error using evalFile

Participant ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

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.

TOPICS
Actions and scripting

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jun 05, 2018 Jun 05, 2018

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.

Votes

Translate

Translate
Adobe
Guide ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

I maybe way off but it does not look right.

$.evalFile(Folder

should it not be

$.evalFile(File

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

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') 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

Additional data, I've now tested it in a Windows 7 VM with a Chinese language pack installed, and in Photoshop with the language set to Japanese. Both cases worked fine. I'm going to switch tactics and see if I can get an empty file to execute correctly.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

I can't remember offhand if BOMs cause trouble. You might want to look into that but it doesn't sound like that's the problem

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

Did you try the using $.evalFile(File.encode(JapPathToFile)) ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

I have not, but I just pushed a version that includes that. I'll report back once I see what happens

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 01, 2018 Jun 01, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

Glad you got it resolved.

That's what jsx.evalFile() does. JSX.js

Taking not to use the evalFile() method and not the evalScript() method

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

i met this problem too,could you paste the final version script?

how to use evalScript?thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

Doesn't SuperMerlin reply help? What code you use?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 18, 2021 May 18, 2021

Copy link to clipboard

Copied

never mind,it's solved,thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 18, 2021 May 18, 2021

Copy link to clipboard

Copied

LATEST

Could you then share your solution with others?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines