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

Input input cyrillic char's in python input work not well #2198

Closed
wennerryle opened this issue May 1, 2024 · 2 comments
Closed

Input input cyrillic char's in python input work not well #2198

wennerryle opened this issue May 1, 2024 · 2 comments
Labels
not a bug / external to nodemon An issue that is outside of nodemon stale no activity for 2 weeks

Comments

@wennerryle
Copy link

Thank you very much for this great library!
I have issues with encoding in python.
When I write russian word test into console it should pass the test, but it don't work well.
I also test just without nodemon and it works

  • Versions: [email protected], [email protected]
  • 3.0.3
  • Operating system/terminal environment (powershell, gitshell, etc): gitshell, vscode
  • Using Docker? What image: nope
  • Command you ran: nodemon main.py

Steps to create this behaviour:

  • create test.py file with this content:
test_str = "тест"
inputed_str = input()

if test_str == inputed_str:
    print("test passed")
else:
    print(f"test_str is: {inputed_str}, expected: {test_str}")
  • write nodemon test.py
  • insert тест into command line
  • press enter
  • do it again but just with python

Expected behaviour

js-everywhere@DESKTOP-AUFNKKJ MINGW64 ~/3D Objects/projects/text_correlation
$ nodemon test.py
[nodemon] 3.0.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: py,json      
[nodemon] starting `python test.py`
тест
test passed

NOT expected behaviour

$ nodemon test.py 
[nodemon] 3.0.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: py,json      
[nodemon] starting `python test.py`
тест
test_str is: теÑ�Ñ‚, expected: тест
[nodemon] clean exit - waiting for changes before restart

If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

Dump is there:

$ nodemon test.py --dump
[nodemon] 3.0.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: py,json
--------------
node: v21.6.0
nodemon: 3.0.3
command: C:\Program Files\nodejs\node.exe C:\Users\js-everywhere\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js test.py --dump
cwd: C:\Users\js-everywhere\3D Objects\projects\text_correlation
OS: win32 x64
--------------
{
  run: false,
  system: {
    cwd: 'C:\\Users\\js-everywhere\\3D Objects\\projects\\text_correlation'
  },
  required: false,
  dirs: [
    'C:\\Users\\js-everywhere\\3D Objects\\projects\\text_correlation'
  ],
  timeout: 1000,
  options: {
    dump: true,
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    ],
    watch: [ '*.*', re: /.*\..*/ ],
    monitor: [
      '*.*',
      '!**/.git/**',
      '!**/.nyc_output/**',
      '!**/.sass-cache/**',
      '!**/bower_components/**',
      '!**/coverage/**',
      '!**/node_modules/**'
    ],
    ignoreRoot: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**'
    ],
    restartable: 'rs',
    colours: true,
    execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' },
    stdin: true,
    runOnChangeOnly: false,
    verbose: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: 'test.py',
      exec: 'python',
      args: [],
      scriptPosition: 0,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'py,json',
      env: {}
    }
  },
  load: [Function (anonymous)],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: { executable: 'python', args: [ 'test.py' ] },
    string: 'python test.py'
  }
}
--------------
Copy link

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

@github-actions github-actions bot added the stale no activity for 2 weeks label May 15, 2024
@remy
Copy link
Owner

remy commented May 19, 2024

@wennerryle I suspect this is actually a terminal encoding problem - I ran the code on my Mac (appreciate it's a different system) and it works as expected:

SCR-20240519-jqnl-min

I'm on a different minor version to you, but I'm fairly sure the version of nodemon won't make a difference and it's actually the OS + terminal that needs to be configured to a consistent character encoding. However, I've no idea how you configure Windows + gitshell + vscode.

If it helps, nodemon is reading the stream as UTF-8 - if you can try to configure your vscode terminal to use that and see how you get on.

Closing as this doesn't appear to be a nodemon specific issue.

@remy remy closed this as completed May 19, 2024
@remy remy added the not a bug / external to nodemon An issue that is outside of nodemon label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug / external to nodemon An issue that is outside of nodemon stale no activity for 2 weeks
Projects
None yet
Development

No branches or pull requests

2 participants