django-sql-sniffer icon indicating copy to clipboard operation
django-sql-sniffer copied to clipboard

Does it work in Windows 10 !?

Open alimp5 opened this issue 3 years ago • 1 comments

Greetings!

I was testing it on windows 10. and I got error below:

Django: 3.1.7 OS: Windows 10 - 64 bit Python: 3.8.6 - 64 bit

(azimzadeh_env1) C:\Users\linux10\Desktop\my_all_envs\azimzadeh_env1\coffehouse>django-sql-sniffer -p 13204
Traceback (most recent call last):
  File "c:\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\linux10\Desktop\my_all_envs\azimzadeh_env1\Scripts\django-sql-sniffer.exe\__main__.py", line 7, in <module>
  File "c:\users\linux10\desktop\my_all_envs\azimzadeh_env1\lib\site-packages\django_sql_sniffer\listener.py", line 31, in main
    injector.inject(str(args.pid), code_to_inject, args.verbose)
  File "c:\users\linux10\desktop\my_all_envs\azimzadeh_env1\lib\site-packages\django_sql_sniffer\injector.py", line 30, in inject
    res = subprocess.run(final_command, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "c:\python38\lib\subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'gdb -p 13204 -batch -eval-command='call PyGILState_Ensure()' -eval-command='call PyRun_SimpleString("exec(open(\"C:\Users\linux10\AppData\Local\Temp\tmpen7_x__s\").read())")' -eval-command='call PyGILState_Release($1)'' returned non-zero exit status 1.

alimp5 avatar Mar 23 '21 05:03 alimp5

Hi there!

Unfortunately I don't have a readily available Windows machine handy, so I only briefly tested django-sql-sniffer on a Win VM - fwiw, you can use it via the Windows subsystem for Linux (probably Cygwin too), just make sure to enable ptrace (echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope). The latest version (1.0.3) is verified to work on Ubuntu 20.04 inside WSL.

Let me know if that works for you.

gruuya avatar Mar 23 '21 20:03 gruuya