Skip to content
Advertisement

Tag: python-3.x

compile official doc “Embedding Python in Another Application” example failed

I am trying to compile and run the example from https://docs.python.org/3/extending/embedding.html#very-high-level-embedding , but failed. My environment is Ubuntu 20.04.2 LTS, with system shipped python3.8(statically built), libpython3-dev and libpython3.8-dev packages installed. What I’ve tried: main.c : From https://docs.python.org/3/extending/embedding.html#compiling-and-linking-under-unix-like-systems, get gcc flags. (I don’t know why python3-config output has some duplicated values, that’s not a typing mistake) gcc {copy cflags output} -o

python script error message ‘unknown column’ – Redhat

My Python script produces unknown column error on redhat 8.5 python 3.6.8. But works without issue on Ubuntu 20.04 with python 3.8.10 Would this be a python or redhat issue? Is it possible to gather more detailed logs? Link to full script https://github.com/michael-pellegrini/scripts/blob/master/xtime.py Redhat error message Ubuntu output Answer Had to clone this repo https://github.com/util-linux/util-linux.git Then follow this how-to found

Syntax error calling Python from C with fork-execv

I want to call a Python script as a child process from a C program using fork and execv. I have tested it calling bin/ls and it works: So I changed the C code to call the Create_Buffer() function in this Python file: The Python script has two functions; I want to call Create_Buffer(), so I changed my C file

SWIG: Access Array of Structs in Python

Say I have the following static constexpr array of c struct: How can I access elements in ns1::ns2::PERSONS in python by using swig? One way I can think of is to create a accessor like const Person& get(uint32_t index) in the swig interface file. Tho, I wonder whether there is a more elegant way that I don’t have to create

Excessive disk writes when using numpy.memmap

I have implemented a file-backed HashTable using numpy.memmap. It appears to be functioning correctly, however, I notice that on Linux both KSysGuard and SMART are reporting ridiculous IO Write amounts. About 50x the amount of data that should be written. I have not tested this on other operating systems. This is the code that creates the internal memory map And

Advertisement