Forums

NameError: name '_pa_run' is not defined

Python 3.6 started to raise this error every time I try to run one of my scripts:

>>> _pa_run(u'/home/yellowparrot/vk/vk_load_info.py')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '_pa_run' is not defined

There is no '_pa_run' method in my code, and I failed to find any mentions of it. Can somebody help?

That's really weird. _pa_run is a function that we use to run your code (so we don't need to keep destroying and re-creating the console every time you run your code). You should never see any reference to that. Seeing it means that there was probably some other error that caused _pa_run to not be available. Is there any other output in your console that we can use to work out what is going on?

No other output, and this error message disappeared when I just copypasted my code to another file. As for now, everything works.

That's a pity. I would have like to have worked out what was going on here. Let us know if you see it again and see if you can capture all the output for us.

Hey guys on an unrelated issue I 'm new to Phyton. I followed the site below https://blog.pythonanywhere.com/121/ but for some reason getting the following error below. Could you assist? Let me know if you need any additional info from me.

2019-08-28 18:15:28,297: Error running WSGI application 2019-08-28 18:15:28,299: ModuleNotFoundError: No module named 'comment' 2019-08-28 18:15:28,300: File "/var/www/edavid_pythonanywhere_com_wsgi.py", line 18, in <module> 2019-08-28 18:15:28,300: from comment import app as application # noqa 2019-08-28 18:15:28,300: ******* 2019-08-28 18:15:28,300: If you're seeing an import error and don't know why, 2019-08-28 18:15:28,300: we have a dedicated help page to help you debug: 2019-08-28 18:15:28,300: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2019-08-28 18:15:28,300: ******* 2019-08-28 18:15:31,084: Error running WSGI application 2019-08-28 18:15:31,261: ModuleNotFoundError: No module named 'comment' 2019-08-28 18:15:31,261: File "/var/www/edavid_pythonanywhere_com_wsgi.py", line 18, in <module> 2019-08-28 18:15:31,261: from comment import app as application # noqa 2019-08-28 18:15:31,261: ******* 2019-08-28 18:15:31,262: If you're seeing an import error and don't know why, 2019-08-28 18:15:31,262: we have a dedicated help page to help you debug: 2019-08-28 18:15:31,262: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2019-08-28 18:15:31,262: ******* 2019-08-28 18:15:33,232: Error running WSGI application 2019-08-28 18:15:33,232: ModuleNotFoundError: No module named 'comment' 2019-08-28 18:15:33,233: File "/var/www/edavid_pythonanywhere_com_wsgi.py", line 18, in <module> 2019-08-28 18:15:33,233: from comment import app as application # noqa 2019-08-28 18:15:33,233: ******* 2019-08-28 18:15:33,233: If you're seeing an import error and don't know why, 2019-08-28 18:15:33,233: we have a dedicated help page to help you debug: 2019-08-28 18:15:33,233: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2019-08-28 18:15:33,233: ******* 2019-08-28 18:15:35,116: Error running WSGI application 2019-08-28 18:15:35,117: ModuleNotFoundError: No module named 'comment' 2019-08-28 18:15:35,117: File "/var/www/edavid_pythonanywhere_com_wsgi.py", line 18, in <module> 2019-08-28 18:15:35,117: from comment import app as application # noqa 2019-08-28 18:15:35,117: ******* 2019-08-28 18:15:35,117: If you're seeing an import error and don't know why, 2019-08-28 18:15:35,117: we have a dedicated help page to help you debug: 2019-08-28 18:15:35,117: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2019-08-28 18:15:35,117: ******* 2019-08-28 18:15:35,176: Error running WSGI application 2019-08-28 18:15:35,177: ModuleNotFoundError: No module named 'comment' 2019-08-28 18:15:35,177: File "/var/www/edavid_pythonanywhere_com_wsgi.py", line 18, in <module> 2019-08-28 18:15:35,177: from comment import app as application # noqa 2019-08-28 18:15:35,178: ******* 2019-08-28 18:15:35,178: If you're seeing an import error and don't know why, 2019-08-28 18:15:35,178: we have a dedicated help page to help you debug: 2019-08-28 18:15:35,178: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2019-08-28 18:15:35,179: *******

I see you've posted a separate question about that on a different thread, so I'll answer there.

Getting the same error. Help.

15:53 ~/si506/problem_sets $ python3 Python 3.7.0 (default, Aug 22 2018, 20:50:05) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.

KeyboardInterrupt _pa_run(u'/home/willidar/si506/problem_sets/problem_set_02.py') Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '_pa_run' is not defined

Do you still have the console with the issue available? If you do, would you mind if we used it to try diagnose the cause of the problem?

I am getting the same issue. please help me fix

Python 3.9.13 (main, Jul 22 2022, 17:05:13) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

_pa_run(u'/home/magicplat/mysite/flask_app.py') Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '_pa_run' is not defined

Looks like you got it working. What was the fix?