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

m2ee barfing when STDOUT redirected/piped #63

Open
hevisko opened this issue Jan 22, 2022 · 3 comments
Open

m2ee barfing when STDOUT redirected/piped #63

hevisko opened this issue Jan 22, 2022 · 3 comments

Comments

@hevisko
Copy link

hevisko commented Jan 22, 2022

m2ee about & status both throw TypeError is seems when output is redirected/piped

acw2@agw-acw-mx01-prod ~ % m2ee about
Using m2ee-tools version 7.2.2
Using Mendix Runtime version 8.18.14.33751
Copyright © 2003-2021 Mendix bv. All rights reserved.
Model version: 3.0.0.1432
acw2@agw-acw-mx01-prod ~ % ls
acw2  m2ee-tools-7.2.3  mx-build.sh  rr.awk
acw2@agw-acw-mx01-prod ~ % m2ee status
INFO: The application process is running, the MxRuntime has status: running
INFO: Logged in users: (1) ['Anonymous_24973d9b-35ae-4258-a635-950a920af4a6']
acw2@agw-acw-mx01-prod ~ % m2ee status | grep running
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.9/logging/__init__.py", line 1082, in emit
    stream.write(msg + self.terminator)
  File "/usr/lib/python3.9/codecs.py", line 378, in write
    self.stream.write(data)
TypeError: write() argument must be str, not bytes
Call stack:
  File "/usr/local/bin/m2ee", line 1050, in <module>
    main()
  File "/usr/local/bin/m2ee", line 1029, in main
    cli.unchecked_onecmd(' '.join(args.onecmd))
  File "/usr/local/bin/m2ee", line 857, in unchecked_onecmd
    super(CLI, self).onecmd(line)
  File "/usr/lib/python3.9/cmd.py", line 217, in onecmd
    return func(arg)
  File "/usr/local/bin/m2ee", line 283, in do_status
    logger.info("The application process is running, the MxRuntime has status: %s" % status)
Message: 'The application process is running, the MxRuntime has status: running'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.9/logging/__init__.py", line 1082, in emit
    stream.write(msg + self.terminator)
  File "/usr/lib/python3.9/codecs.py", line 378, in write
    self.stream.write(data)
TypeError: write() argument must be str, not bytes
Call stack:
  File "/usr/local/bin/m2ee", line 1050, in <module>
    main()
  File "/usr/local/bin/m2ee", line 1029, in main
    cli.unchecked_onecmd(' '.join(args.onecmd))
  File "/usr/local/bin/m2ee", line 857, in unchecked_onecmd
    super(CLI, self).onecmd(line)
  File "/usr/lib/python3.9/cmd.py", line 217, in onecmd
    return func(arg)
  File "/usr/local/bin/m2ee", line 294, in do_status
    total_users = self._who(max_show_users)
  File "/usr/local/bin/m2ee", line 815, in _who
    logger.info("Logged in users: (%s) %s" %
Message: "Logged in users: (1) ['Anonymous_24973d9b-35ae-4258-a635-950a920af4a6']"
Arguments: ()
acw2@agw-acw-mx01-prod ~ %
 % m2ee about | cat
Traceback (most recent call last):
  File "/usr/local/bin/m2ee", line 1050, in <module>
    main()
  File "/usr/local/bin/m2ee", line 1029, in main
    cli.unchecked_onecmd(' '.join(args.onecmd))
  File "/usr/local/bin/m2ee", line 857, in unchecked_onecmd
    super(CLI, self).onecmd(line)
  File "/usr/lib/python3.9/cmd.py", line 217, in onecmd
    return func(arg)
  File "/usr/local/bin/m2ee", line 361, in do_about
    print('Using m2ee-tools version %s' % m2ee.__version__)
  File "/usr/lib/python3.9/codecs.py", line 378, in write
    self.stream.write(data)
TypeError: write() argument must be str, not bytes
@hvisage
Copy link

hvisage commented Aug 7, 2023

m2ee still doesn't work as great inside supervisor/etc.

@hevisko
Copy link
Author

hevisko commented Aug 10, 2023

This is even more... challenging, when using Ansible ;(

@hvisage
Copy link

hvisage commented Aug 22, 2023

I've made a PR (but seems it's included in my pg_restore commits/PR ;( ) that makes a small change to m2ee(.py) to have a m2ee-pipe command be executing in the same why when piped or on "terminal", ie. easier for Ansible playbooks: 5cc3f95 #70

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

No branches or pull requests

2 participants