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

Compiled sucessfully in Windows 10 Python 3.11 but CreateProcess fails (call to dispread to measure) #367

Closed
VgerTest opened this issue May 21, 2024 · 35 comments · Fixed by #374

Comments

@VgerTest
Copy link

VgerTest commented May 21, 2024

 Traceback (most recent call last):                                           
  File "D:\src\otros\displaycal-py3.py311\DisplayCAL\worker.py", line 7082,  
 in exec_cmd                                                                  
     self.subprocess = wexpect.spawn(                                         
                       ^^^^^^^^^^^^^^                                         
   File "D:\src\otros\displaycal-py3.py311\DisplayCAL\wexpect.py", line 328,  
 in spawn                                                                     
     return spawn_windows(                                                    
            ^^^^^^^^^^^^^^                                                    
   File "D:\src\otros\displaycal-py3.py311\DisplayCAL\wexpect.py", line 1775, 
 in __init__                                                                  
     self._spawn(command, args)                                               
   File "D:\src\otros\displaycal-py3.py311\DisplayCAL\wexpect.py", line 1848, 
 in _spawn                                                                    
     self.child_fd = self.wtty.spawn(self.command, self.args, self.env)       
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^       
   File "D:\src\otros\displaycal-py3.py311\DisplayCAL\wexpect.py", line 2073, 
 in spawn                                                                     
     self.startChild(args, env)                                               
   File "D:\src\otros\displaycal-py3.py311\DisplayCAL\wexpect.py", line 2174, 
 in startChild                                                                
     self.__oproc, _, self.conpid, self.__otid = CreateProcess(               
                                                 ^^^^^^^^^^^^^^               
 TypeError: Objects of type 'bytes' can not be converted to Unicode.         

It does not like this:

        self.__oproc, _, self.conpid, self.__otid = CreateProcess(
            None, commandLine, None, None, False, CREATE_NEW_CONSOLE, env, self.cwd, si
        )
@wisdomk
Copy link

wisdomk commented May 22, 2024

same issue here ... I am very frustrated, I've spent like 5 hours trying to make this thing work on Windows with no avail.
On Ubuntu and Mac it works like a charm though.

@eoyilmaz
Copy link
Owner

eoyilmaz commented Jun 1, 2024

okay I'll look into this shortly

@eoyilmaz
Copy link
Owner

eoyilmaz commented Jun 2, 2024

Fixed this, but there are other problems preventing DisplayCAL to run properly... working on it.

@eoyilmaz
Copy link
Owner

eoyilmaz commented Jun 2, 2024

I think we need to use the PyPI version of wexpect now... Our version is old and not working properly...

@eoyilmaz
Copy link
Owner

eoyilmaz commented Jun 5, 2024

Still working on this with no avail...

The main problem is that DisplayCAL cannot read from the stdout of the child process that is spawned through DisplayCAL.wexpect module. I tried using the Wexpect module from PyPI, hopefully the interface has not been changed and DisplayCAL was able to use it to spawn processes. But it is didn't solve the problem. Then I tried using different Python versions, i.e 3.9, 3.10, 3.11, 3.12, in none of them the Wexpect is working properly. Tried using utf-8 instead cp1252 (which was the default) for the code page, not working... Tried using different ArgyllCMS versions from 3.02, 3.1.0 to 3.2.0, same error.

I believe in the past with an update called "Windows Creators Update" the behaviour of the stdout has changed, still trying to understand why it is not working...

@eoyilmaz
Copy link
Owner

eoyilmaz commented Jun 5, 2024

As always as soon as I sent a progress message here I solve something 😄

Apparently setting the "PYTHONLEGACYWINDOWSSTDIO" environment variable to anything reverts the behaviour change and I can now start the measurement and finally was able to skip the first couple of colour patches. But unfortunatelly, it is not progresssing any further...

@eoyilmaz
Copy link
Owner

eoyilmaz commented Jun 5, 2024

Finally, I managed to make it work...

Obviously we had an encoding issue under Windows and one another issue was the DisplayCAL.worker._safe_send() was trying to encode whatever it was trying to send to the subprocess to bytes and it was not working properlly under Windows. Now all seems to be fixed and I'm currently doing a profiling and it is working fine 👍

aaand profiling is done... but it seems that there are other issues and no profile has been created... let's fix them too.

eoyilmaz added a commit that referenced this issue Jun 5, 2024
…ndows by setting the `PYTHONLEGACYWINDOWSSTDIO` environment variable. This is a temporary fix and the neccessary changes to allow `utf-8` encoding.

[#367] Fixed `DisplayCAL.worker._safe_send()` for Windows.
[#367] Updated `README.md` for Windows install instructions.
eoyilmaz added a commit that referenced this issue Jun 5, 2024
…ndows by setting the `PYTHONLEGACYWINDOWSSTDIO` environment variable. This is a temporary fix and the neccessary changes to allow `utf-8` encoding will be introduced in future.

[#367] Fixed `DisplayCAL.worker._safe_send()` for Windows.
[#367] Updated `README.md` for Windows install instructions.
@eoyilmaz
Copy link
Owner

eoyilmaz commented Jun 5, 2024

Okay fixed a couple more problems and I was able to finish my first calibration and profile generation under Windows 10 🎆

eoyilmaz added a commit that referenced this issue Jun 5, 2024
eoyilmaz added a commit that referenced this issue Jun 5, 2024
eoyilmaz added a commit that referenced this issue Jun 5, 2024
…handlers` attribute in `DisplayCAL.multiprocess.WorkerFunc.__call__()`.
eoyilmaz added a commit that referenced this issue Jun 5, 2024
…profile_loader.setup_profile_loader_task()`.
eoyilmaz added a commit that referenced this issue Jun 5, 2024
… replace the space characters in the returned string with "_" to fix profile installation under Windows.
eoyilmaz added a commit that referenced this issue Jun 5, 2024
eoyilmaz added a commit that referenced this issue Jun 5, 2024
eoyilmaz added a commit that referenced this issue Jun 5, 2024
@eoyilmaz eoyilmaz changed the title Compiled sucessfully in W10 py3.11 but CreateProcess fails (call to dispread to measure) Compiled sucessfully in Windows 10 Python 3.11 but CreateProcess fails (call to dispread to measure) Jun 5, 2024
@eoyilmaz
Copy link
Owner

eoyilmaz commented Jun 5, 2024

Anyone who wants to try DisplayCAL under Windows, I updated the installation instructions here: How To Install (Windows)

Please try and report back.

eoyilmaz added a commit that referenced this issue Oct 9, 2024
…profile_loader.setup_profile_loader_task()`.
eoyilmaz added a commit that referenced this issue Oct 9, 2024
… replace the space characters in the returned string with "_" to fix profile installation under Windows.
eoyilmaz added a commit that referenced this issue Oct 9, 2024
eoyilmaz added a commit that referenced this issue Oct 9, 2024
eoyilmaz added a commit that referenced this issue Oct 9, 2024
eoyilmaz added a commit that referenced this issue Oct 9, 2024
eoyilmaz added a commit that referenced this issue Oct 9, 2024
eoyilmaz added a commit that referenced this issue Oct 9, 2024
…er any `None` values in the `args` argument.
eoyilmaz added a commit that referenced this issue Oct 9, 2024
…changed()` to use the `REG_QWORD` value directly instead of trying to unpack it as the value is an `int` already.
eoyilmaz added a commit that referenced this issue Oct 10, 2024
…rce distributions in `DisplayCAL.setup`.
eoyilmaz added a commit that referenced this issue Oct 10, 2024
…et allowing the `venv` target to just create the virtualenv.
eoyilmaz added a commit that referenced this issue Oct 10, 2024
… the `Makefile`.

- [#367] Fix `build` target in the `Makefile` to first activate the virtual environment and then install the requirements.
eoyilmaz added a commit that referenced this issue Oct 10, 2024
@Ivanmatthew
Copy link

Thank you for your efforts @eoyilmaz
Cheers! 🥂

@Headcrabed
Copy link

@eoyilmaz Seems this new version has a encoding problem on my Simplified Chinese Windows 11. You might need to force text encoding somewhere:

D:\Tools\Argyll_V3.2.0\bin\dispcal.exe -v2 -d1 -c1 -yl                       │
│ -P0.787200832466181,0.40897755610972564,1.4941451990632322 -H -Ibw -qm       │
│ -w0.3127,0.329 -b{luminance} -gs -f1.0 -A4.0 ULTRAGEAR #1 2024-10-11 03-04   │
│ 120cdm² 0.3127x 0.329y sRGB M-S XYZLUT+MTX                                   │
│ Traceback (most recent call last):                                           │
│   File "C:\Program Files\Python311\Lib\site-packages\DisplayCAL\worker.py",  │
│ line 7091, in exec_cmd                                                       │
│     self.subprocess = wexpect.spawn(                                         │
│                       ^^^^^^^^^^^^^^                                         │
│   File "C:\Program Files\Python311\Lib\site-packages\DisplayCAL\wexpect.py", │
│ line 372, in spawn                                                           │
│     log("Spawning {}".format(join_args([command] + args)))                   │
│   File "C:\Program Files\Python311\Lib\site-packages\DisplayCAL\wexpect.py", │
│ line 2992, in log                                                            │
│     fout.write(                                                              │
│ UnicodeEncodeError: 'gbk' codec can't encode character '\xb2' in position    │
│ 240: illegal multibyte sequence

@eoyilmaz
Copy link
Owner

@Headcrabed let's make a new issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants