Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server does not start when language set to Chinese #72

Closed
qigesmn opened this issue Feb 25, 2022 · 5 comments
Closed

Server does not start when language set to Chinese #72

qigesmn opened this issue Feb 25, 2022 · 5 comments
Labels
fixed Fix for issue has been released.

Comments

@qigesmn
Copy link

qigesmn commented Feb 25, 2022

Thanks for sharing this practical package.
On line 133 of 'server.py', the code:
match = regex(r'(?i)^Comsol.+?server.+?(\d+)$', line.strip())
it may cause loop while setting Chinese as the as the programming language in comsol.

@john-hen
Copy link
Collaborator

Hi, thanks for reporting this. You probably mean line 113. I will need your help with this. Apparently the console output of comsolmphserver is language-dependent (which complicates things). That regular expression filters out the port number, and there's no other way to query it, so we will have to make the regex more flexible.

What's the output you get when you start comsolmphserver on the command line? For example, with Comsol 5.6 installed on Windows and language set to English:

C:\temp> "C:\Program Files\COMSOL\COMSOL56\Multiphysics\bin\win64\comsolmphserver"
COMSOL Multiphysics server 5.6 (Build: 401) started listening on port 2036
Use the console command 'close' to exit the program
close

If you're on Linux or macOS, the command would be comsol mphserver.

@john-hen john-hen changed the title The regex could not work When setting Chinese as the programming language in comsol Server does not start when language set to Chinese Feb 25, 2022
@john-hen john-hen added the bug Something isn't working. label Feb 25, 2022
@qigesmn
Copy link
Author

qigesmn commented Feb 25, 2022

Hi, thanks for replying. I do mean line 113, oops :-)
The environment is Ubuntu 18.04 with Chinese and Comsol 5.6 MultiPhysics with Chinese. The console output of comsolmphserver do have Chinese characters, I will report the details later. I have run it successfully under original English settings.Obviously, the regular expression does filter some particular cases, I will test an alternative regular expression and report it later.

@qigesmn
Copy link
Author

qigesmn commented Feb 28, 2022

The output when starting comsolmphserver is:
COMSOL Multiphysics server 5.6 (开发版本: 341) 开始在端口 2037 上监听
Obvious the sentence does not end with a port number.
I think the regular expression r'(?i)^Comsol.+?server.+?(\d+)$' should be refined to deal with more situations, or directly declare that the environment should be limited to the original language settings.
At last, thanks again for sharing this wonderful package!

john-hen added a commit that referenced this issue Feb 28, 2022
This should fix issue #72, where the server would not start when
Comsol was installed with the interface language set to Chinese.

Parsing is now handled by a separate function so that it can be
unit-tested. Currently, English (the default), German (issue #24),
and Chinese (issue #72) output from the server process is being
run against the regular expression. It is expected to work for
all languages, effectively just looking for a four- or five-digit
number in the line that begins with "COMSOL".
@john-hen
Copy link
Collaborator

thanks again for sharing this wonderful package!

Always happy to hear. 😄 Thanks.

should be refined to deal with more situations, or directly declare that the environment should be limited to the original language settings.

We definitely want to support all languages. It's just a little difficult to test, as I would have to go through the installer many times, and in languages I cannot even read.

I've now added tests for Chinese, the default English, as well as German (previously reported in issue #24). In case the latest iteration of that regular expression doesn't work for some other language, people can open another issue and we'll fix that and add that language to the tests.

I did see, just now, that there's also a way of having the server write the port out to a file. That would probably be the cleanest solution, but takes a little more work. I might implement that some other time.

@john-hen john-hen added fixed Fix for issue has been released. and removed bug Something isn't working. labels Feb 28, 2022
@john-hen
Copy link
Collaborator

Fixed in MPh 1.1.5, released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Fix for issue has been released.
Projects
None yet
Development

No branches or pull requests

2 participants