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.
- 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.
I maybe way off but it does not look right.
should it not be
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')
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.
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
Did you try the using $.evalFile(File.encode(JapPathToFile)) ?
I have not, but I just pushed a version that includes that. I'll report back once I see what happens
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 https://sentry.io), 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.
i met this problem too,could you paste the final version script?
how to use evalScript?thanks.
never mind,it's solved,thanks
Could you then share your solution with others?