Python Forum
[CPython] Can't run script python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[CPython] Can't run script python
#1
Hi all,

I have a problem need your help.
Thanks in advance.

1. Context:
I customized source code CPython 3.9.6 (https://www.python.org/downloads/release/python-396/)
In detailed, instead of reading directories from config, i fixed some directories sys._base_executable = '/', sys.base_prefix = '/mfp', sys.base_exec_prefix = '/mfpsys',...

2. Problem
I run into a problem when run script Python. I got the following log
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/'
sys.base_prefix = '/mfpsys'
sys.base_exec_prefix = '/mfpsys'
sys.platlibdir = 'lib'
sys.executable = '/'
sys.prefix = '/mfpsys'
sys.exec_prefix = '/mfpsys'
sys.path = [
'/site-packages',
'/mfpsys/lib/python3.9',
'/mfpsys/lib/python3.9/lib-dynload',
'/mfpsys/lib/python3.9/site-packages',
]
LookupError: no codec search functions registered: can't find encoding

I have investigated in source code Python 3.9.6, found the related source code show above error log.

\Python-3.9\Python\codecs.c
PyObject* _PyCodec_Lookup(const char* encoding)
{
...
const Py_ssize_t len = PyList_Size(interp->codec_search_path);

if (len == 0) {
PyErr_SetString(PyExc_LookupError,
"no codec search functions registered: "
"can't find encoding");
goto onError;
}
...
}

I have no idea to this problem. Please give me your kind suggestion.
Reply


Messages In This Thread
[CPython] Can't run script python - by VietVH - May-21-2022, 03:32 PM
RE: [CPython] Can't run script python - by VietVH - May-21-2022, 04:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,490 Jun-29-2023, 11:57 AM
Last Post: gologica
  ImportError: /home/ali/Documents/test/charm/core/crypto/AES.cpython-39-x86_64-linux-g Anldra12 0 1,280 Apr-28-2022, 07:13 AM
Last Post: Anldra12
  Reducing runtime memory usage in Cpython interpreter david_the_graower 2 2,291 Oct-18-2021, 09:56 PM
Last Post: david_the_graower
  Navigating cpython source using python quazirfan 3 2,082 Aug-09-2021, 07:52 PM
Last Post: quazirfan
  IronPython from CPython amasis 3 2,325 Feb-05-2021, 12:26 PM
Last Post: jefsummers
  ImportError: /home/pybind11_example.cpython-37m-x86_64-linux-gnu.so: undefined symbol chaitra 2 5,214 Feb-03-2021, 05:14 AM
Last Post: chaitra
  How to kill a bash script running as root from a python script? jc_lafleur 4 6,036 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,368 May-28-2020, 05:27 PM
Last Post: micseydel
  compiled cpython output wrong version bigrockcrasher 0 1,543 Feb-25-2020, 06:31 PM
Last Post: bigrockcrasher
  Package python script which has different libraries as a single executable or script tej7gandhi 1 2,672 May-11-2019, 08:12 PM
Last Post: keames

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020