pythonprofilers / memory_profiler

Monitor Memory usage of Python code
http://pypi.python.org/pypi/memory_profiler
Other
4.39k stars 380 forks source link

non-ascii source characters misprocessed (maybe through 8859?) #389

Open altendky opened 1 year ago

altendky commented 1 year ago
          I get this bug at the very fist instance of a special character:
(base) C:\Users\me\.spyder-py3>mprof run "myfile V2.36.py"
mprof: Sampling memory every 0.1s
running new process
running as a Python program...
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\lib\site-packages\memory_profiler.py", line 1303, in <module>
    exec_with_profiler(script_filename, prof, args.backend, script_args)
  File "C:\ProgramData\Anaconda3\lib\site-packages\memory_profiler.py", line 1204, in exec_with_profiler
    exec(compile(f.read(), filename, 'exec'), ns, ns)
  File "myfile V2.36.py", line 277
    Gasdurchströmt = 1          # nimmt das Gas Wärme auf?
                ^
SyntaxError: invalid character '¶' (U+00B6)

It should say Gasdurchströmt = 1. First line of my program: # -*- coding: utf-8 -*-

_Originally posted by @Eheran1 in https://github.com/pythonprofilers/memory_profiler/issues/113#issuecomment-1495799190_

altendky commented 1 year ago

Not saying I'm going to get this fixed, but this looks like a separate, albeit related, bug.

Eheran1 commented 1 year ago

Thank you. Why do you think it is related but not essentially the same bug?

altendky commented 1 year ago

Just at a glance at the reports, I think it's in the same area, or even a bug in the fix of the previous bug. But since the previous has been 'fixed and closed' it seems worth documenting this separately, while retaining the reference to related context, so it gets tracked directly. If the existing work was still in progress, yeah, I would have wanted this to at least be considered in the original solution unless it was really proven to be separate.

I don't think there's a hard rule here, I just took my quick guess as to what would make it less likely for your issue to get lost in the noise. That's especially important in projects like this that are not maintained since only the most clear issues stand some chance of being addressed.

After all that, I left the bad automatic issue title though... I just corrected it.