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

367 compiled sucessfully in w10 py311 but createprocess fails call to dispread to measure #374

Conversation

eoyilmaz
Copy link
Owner

@eoyilmaz eoyilmaz commented Jun 6, 2024

DisplayCAL now runs properly on Windows with Python 3.9, 3.10 and 3.11.

@eoyilmaz eoyilmaz force-pushed the 367-compiled-sucessfully-in-w10-py311-but-createprocess-fails-call-to-dispread-to-measure branch from 22d0e1b to 89bf969 Compare June 7, 2024 22:09
@AstralStorm
Copy link

AstralStorm commented Jun 18, 2024

Ok, it fails to attach a TTY right to the subprocess and hangs, and I actually get a nice isatty NoneType AttributeError on Windows if launched via pythonw.
Log is likewise busted for the same reason.

So, wexpect/tty issues it appears. Will see what I can do about them.

@AstralStorm
Copy link

AstralStorm commented Jun 18, 2024

Ok, so it appears that frozen version does something extra in its script to make wexpect work:

From wexpect.py - that's probably the secret sauce, it runs a subscript that does something to grab the console... and utterly fails. The executable is launched but sits there. I need more logs from wexpect to see what's up.

@AstralStorm
Copy link

AstralStorm commented Jun 18, 2024

2024-06-18 13:04:14,535 Traceback (most recent call last):
  File "C:\Projects\displaycal_venv\Lib\site-packages\DisplayCAL\wexpect.py", line 2621, in __init__
    SetConsoleOutputCP(cp)
TypeError: SetConsoleOutputCP() argument 1 must be int, not str

And that's that. Not sure how you want to set it to utf-8 with this API by string. It should be number 65001.

@AstralStorm
Copy link

AstralStorm commented Jun 18, 2024

There's more, I have a patch cooking, though while it's working, I'm not sure it's fully correct and I need to clean it up.

Specifically new Python as launched by wexpect gets no standard handles (stdin/out/err), while the Argyll subprocess created from that is told to inherit the handles - because new Python sets this process flag for itself, presumably so that it can thread and subprocess as expected.
Since there's no stdio, Argyll processes told to run interactively just terminate.
I can tell it to have its new fresh stdio, and it seems to work. One thing I'm not sure is whether the console is inherited or created anew ignoring all the settings we gave it.

Plus there's yet another Unicode bug in WAIT_TEMPLATE which I fixed.

@AstralStorm
Copy link

See #383 for the additional fixes. This is on top of this branch.

@nelsonlim
Copy link

Hi, not sure if this is the place to post this or this should be a new issue.

I tried going through the windows manual install process in the readme to build and run this branch.

Encountering the below error where the argyll executable could not be started. I'm including the terminal output below if it's helpful.

I'm on Windows 11 and Python 3.11.3.

Thanks for the effort at modernizing DisplayCAL!

Cheers
Nelson

$ python -m DisplayCAL
Acquired lock file: <DisplayCAL.main.AppLock object at 0x00000214103BA510>
__main__.py 3.9.12 2024-07-11T16:59:35Z
Windows 10 Education Version 2009 Build 22631.3737 x86_64
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]
CA file C:\Users\Nelson Lim\.virtualenvs\displaycal-py3-Ub8jokFz\Lib\site-packages\certifi\cacert.pem
Faulthandler
wxPython 4.2.1 msw (phoenix) wxWidgets 3.2.2.1
Encoding: utf-8
File system encoding: utf-8
Loading C:\Users\Nelson Lim\AppData\Roaming\DisplayCAL\DisplayCAL.ini
listening
writing to lock file: port: 15411
No module named 'comtypes.gen'
Error - could not import WMI: No module named 'wmi'
C:\NL\2_Areas\dev\displaycal-py3\DisplayCAL\wxMeasureFrame.py:42: Warning: No module named 'DisplayCAL.lib64.python311.RealDisplaySizeMM'
  warnings.warn(str(exception), Warning)
Starting up...
Audio module: pyglet 2.0.15
Enumerating display devices and communication ports...
C:\Users\Nelson Lim\AppData\Roaming\DisplayCAL\dl\Argyll_V2.1.2\bin
ArgyllCMS 2.1.2
Argyll has virtual display support
...ok.
Checking video card gamma table access for display 1...
Verify: 'test.cal' IS loaded (discrepancy 0.0%)
...ok.
Checking video card gamma table access for display 2...
Verify: 'test.cal' IS loaded (discrepancy 0.0%)
...ok.
Initializing GUI...

input_value_clipping_bmp should have been hidden
output_profile_ctrl should have been hidden
instrument_name: i1 DisplayPro, ColorMunki Display
display_name   : Generic PnP Monitor
...ok.
Ready.
Setting up scripting host at 127.0.0.1:15411
Check for application update...
DisplayCAL is up-to-date.
┌──────────────────────────────────────────────────────────────────────────────┐
│ An update is available: ArgyllCMS 3.2.0                                      │
└──────────────────────────────────────────────────────────────────────────────┘
-> Update now
Using CA file C:\Users\Nelson Lim\.virtualenvs\displaycal-py3-Ub8jokFz\Lib\site-packages\certifi\cacert.pem
Connecting to https://www.argyllcms.com:443...
Downloading https://www.argyllcms.com//Argyll_V3.2.0_win64_exe.zip → C:\Users\Nelson Lim\AppData\Roaming\DisplayCAL\dl\Argyll_V3.2.0_win64_exe.zip
...ok.
Warning - DisplayCAL-apply-profiles not running?
Enumerating display devices and communication ports...
C:\Users\Nelson Lim\AppData\Roaming\DisplayCAL\dl\Argyll_V3.2.0\bin
ArgyllCMS 3.2.0
Argyll has virtual display support
...ok.
--------------------------------------------------------------------------------
Calibrate & profile
Detecting output levels range...
--------------------------------------------------------------------------------
Session log: 0_16

Working directory:
  C:\
   Users\
    NELSON~1\
     AppData\
      Local\
       Temp\
        DisplayCAL-iwot_97o\

Command line:
  C:\Users\Nelson Lim\AppData\Roaming\DisplayCAL\dl\Argyll_V3.2.0\bin\dispread.exe
    -v
    -k
    C:\NL\2_Areas\dev\displaycal-py3\DisplayCAL\linear.cal
    -d2
    -c1
    -yn
    "-P0.5382692908466105,0.4411571334648258,1.6218274111675128"
    -F
    0_16

┌──────────────────────────────────────────────────────────────────────────────┐
│ The process C:\Users\Nelson                                                  │
│ Lim\AppData\Roaming\DisplayCAL\dl\Argyll_V3.2.0\bin\dispread.exe could not   │
│ be started.                                                                  │
└──────────────────────────────────────────────────────────────────────────────┘

@AstralStorm
Copy link

@nelsonlim You should try my branch, yes it includes this one. That is supposed to work, drop me a line if it does not.

@eoyilmaz
Copy link
Owner Author

eoyilmaz commented Sep 22, 2024

@nelsonlim please report this in another ticket, I'm ready to merge this one.

…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.
…handlers` attribute in `DisplayCAL.multiprocess.WorkerFunc.__call__()`.
…profile_loader.setup_profile_loader_task()`.
… replace the space characters in the returned string with "_" to fix profile installation under Windows.
…version number to allow the embedded manifest to follow Microsoft rules and the frozen executable to run.
…layCAL.wxScriptingClient` for `bytes` vs `str` problems.
…tialize the `print_` arg with `None` and set its default value inside the method, instead of writing a complex expression on the argument itself.
…e returned by the `kernel32` library instead of manually setting it to `utf-8` as `cp1252` seems to be working fine, after #383 has been merged. And, simplified a couple of `if` statements that are checking the `stdout.isatty()` value, and updated code formatting.
…commands through `py2exe` frozen `python` interpretter.
… that the installer uses "Program Files" instead of "Program Files (x86)" by default.
…file path between quotes to prevent space characters in the file path to cause any errors.
…conf()` for a `str` vs `bytes` error raised when the VCGT doesn't have exactly 256 entries.
…splayCAL.wxfixes.GenBitmapTextButton.DrawLabel()` to use `int` arguments.
…gs under Windows and not under Linux/MacOS.
…rce distributions in `DisplayCAL.setup`.
…et allowing the `venv` target to just create the virtualenv.
… the `Makefile`.

- [#367] Fix `build` target in the `Makefile` to first activate the virtual environment and then install the requirements.
@eoyilmaz eoyilmaz merged commit eab185d into develop Oct 10, 2024
12 checks passed
@eoyilmaz eoyilmaz deleted the 367-compiled-sucessfully-in-w10-py311-but-createprocess-fails-call-to-dispread-to-measure branch October 10, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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