r/learnpython • • Oct 10 '26

Running Under Various LibC OS Package Compatibility

1 Upvotes

My system uses "glibc" which seems most common (yes, this is about "python". I'll get there...).

I'm aware of "musl" and LLVM's "libc", as well as "bionic" (heard of before, but only just now am aware it's Android's).

About a month or two ago I had an idea to serve a locally run AI model via my phone.

I began with installing the "termux" app which easily got me the "ollama" package installed.

My memory is hazy, but I think I then tried to install "open-webui" in termux via "pip", but think that failed for some reason. And I had not put the issue in my notes, but asking AI, I think it was because there may have been a package that could not be built for "bionic".

When I installed the "proot-dist" package, I installed "open-webui" in an Ubuntu instance and that worked.

Should I expect that is the norm for the not-as-common "libc" OS' (not just specific to bionic), that some packages/dependencies may only be built for a given libc (eg glibc)?


r/learnpython • • Oct 10 '26

How can I start to understand logical assignment questions more intuitively?

4 Upvotes

So I’m a first year software engineering student and in my intro to programming class we’re learning Python. So far I’ve mostly understood everything in theory but when it comes down to practice I struggle a lot because they ask us to do certain things for assignments that require a lot of logic to do them which I’m struggling with. So I was wondering how I can start to understand the questions more intuitively so I don’t fall behind in the class. And to clarify I do work on some practice questions every now and then but due to my schedule and the fact I haven’t properly organized it yet I haven’t been able to practice a whole lot.


r/learnpython • • Oct 09 '26

How do I use MixedNB with GridsearchCV

2 Upvotes

I got this code block which I used to hypertuning Naive Bayes models. It worked well with GaussianNB but ran into AttributeError: 'MixedNB' object has no attribute '__sklearn_tags__' when trying to implement it on MixedNB. Any idea on how to use GridsearchCV with MixedNB?

param_grid_nb = {
    'var_smoothing': np.logspace(0,-9, num=100)
}
mix_model_after_cv = GridSearchCV(estimator=MixedNB(), param_grid=param_grid_nb, verbose=1, cv=10, n_jobs=-1)
mix_model_after_cv.fit(X_train, y_train)
print(mix_model_after_cv.best_estimator_)

r/learnpython • • Oct 09 '26

Spreadsheet automation idea

1 Upvotes

I'm developing a spreadsheet automation project capable of merging multiple spreadsheets into one and automatically performing calculations, among other things. One of the functionalities would be, for example, allowing someone to gather all the spreadsheets from those months into a single spreadsheet throughout an entire year, obtaining an overall result for the year. This could work based on week, day, month, or some other parameter. I have some doubts, but the project seems promising. I'm using the openpyxl library and, to create the website or application (I'm still undecided), I will use HTML, CSS, and Flask.


r/learnpython • • Oct 09 '26

any cybersecurity guy who can decrypt this:

0 Upvotes

1 13.14.1 4.20.14.19.7.9.1.14 14.15 8.5.20 5.5.22.18.5.9.1.18.7.4., 7.14.21 9.14 8.9.19 4.8.1.14 16.20.14.9.15.14.7.9 20.15 8.9.19 4.....5.8..1...

above is the encrypted text i encrypted by a python program i wrote, the text is just a query i want from technerds to get the idea of how safe(encrypted) is my text would be.


r/learnpython • • Oct 09 '26

Python Loop Dry Run Breakdown

0 Upvotes

Hey everyone! If you are learning Python loops, here is a quick step-by-step breakdown (dry run) of how this while loop calculates the total:

Initial State: total = 0, n = 1

• Loop 1 (n = 1):

total += 1 * 2 -> total becomes 2

n becomes 2

• Loop 2 (n = 2):

total += 2 * 2 -> total becomes 2 + 4 = 6

n becomes 3

• Loop 3 (n = 3):

total += 3 * 2 -> total becomes 6 + 6 = 12

n becomes 4

• Loop 4 (n = 4):

total += 4 * 2 -> total becomes 12 + 8 = 20

n becomes 5

Condition check (n <= 4) fails because 5 is not less than or equal to 4. Loop terminates.

Final Output: 20

I regularly post such step-by-step Python debugging guides and logic breakdowns on my blog to help beginners understand programming logic easily. Check out more detailed explanations here: https://pydebug.in


r/learnpython • • Oct 09 '26

Online sandbox for helping my son learn?

2 Upvotes

My son just started taking an intro to cyber security class in high school. The teacher is exposing them to some basic python coding, which is all new to him. Coding in general is new to him. He started asking me questions and I was wondering if there is a simple to use web-based interface where we can mess around with some python stuff together.

Someone had mentioned Replit but it just seems completely drowning in AI agents and is not really what I want to mess with.

I know we could set up VS code or a full ID but I think that’s overkill for right now. Are there any simple lightweight sandbox type websites where we could play around with some simple scripts and programming constructs save those things to the cloud and easily have them accessible, even if I’m just sitting with him and we have our phones nearby.

Thanks


r/learnpython • • Oct 09 '26

I am newbe and I need for create exe with "folder" import

0 Upvotes
The structure of my project is as follows:
Python Modify HostName
->main.py
->palworld-save-toolkit
->->python ->[..]
->->vendor ->[..]

in vs code work all.

I know be exe with pyinstaaller but no work load toolkit and pyooz (?).

My partially code is (if need full code i load github today after work)

TOOLKIT_PY = RESOURCE_DIR / "palworld-save-toolkit" / "python"
VENDOR_PY = TOOLKIT_PY / "vendor"



def load_toolkit():
    """Import the toolkit's PlM/Oodle-aware parser ahead of any installed copy."""
    if not getattr(sys, "frozen", False):
        for path in (str(TOOLKIT_PY), str(VENDOR_PY)):
            if path not in sys.path:
                sys.path.insert(0, path)
    print(f"TOOLKIT_PY: {TOOLKIT_PY}")
    print(f"VENDOR_PY: {VENDOR_PY}")
    from palworld_save_tools.archive import UUID
    from palworld_save_tools.gvas import GvasFile
    from palworld_save_tools.palsav import compress_gvas_to_sav, decompress_sav_to_gvas
    from palworld_save_tools.paltypes import PALWORLD_CUSTOM_PROPERTIES, PALWORLD_TYPE_HINTS
    return UUID, GvasFile, compress_gvas_to_sav, decompress_sav_to_gvas, PALWORLD_CUSTOM_PROPERTIES, PALWORLD_TYPE_HINTS



def parse_player_roster(world: Path) -> list[dict[str, str]]:
    """Read player file IDs and names/levels from the world's Level.sav."""
    UUID, GvasFile, _, decompress, custom, hints = load_toolkit()
    players: dict[str, dict[str, str]] = {}
    for file in sorted((world / "Players").glob("*.sav")):
        with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):
            raw, _ = decompress(file.read_bytes())
            data = GvasFile.read(raw, hints, custom, allow_nan=True).dump()
        sd = data["properties"]["SaveData"]["value"]
        guid = file.stem.upper()
        players[guid] = {"guid": guid, "name": "", "level": "?"}
        instance_id = str(sd["IndividualId"]["value"]["InstanceId"]["value"])
        players[guid]["instance"] = instance_id

I ask gpt but not know how resolve

Why, when I compile the executable into an .exe, does it seem unable to read the save files? It’s as if it fails to load load_toolkit. 0:39

Work duration: 3m 39s

Yes, there were two path issues in the project:

The spec file PalWorldSwitchHostSaveGame.spec didn't include palworld-save-toolkit, so in the EXE load_toolkit() could fail because it couldn't find the parser.

Some paths used __file__, which in a PyInstaller EXE doesn't reliably identify the app's folder.

I updated [main.py](E:/chrig/Documenti/Palworlds saveames/PalWorldSwitchHostSaveGame/PythonModifySavegame/main.py) to distinguish between resources bundled inside the EXE and the app folder, and [PalWorldSwitchHostSaveGame.spec](E:/chrig/Documenti/Palworlds saveames/PalWorldSwitchHostSaveGame/PalWorldSwitchHostSaveGame.spec) to include both the toolkit and the icon. Palworld save files are looked up under %LOCALAPPDATA%\Pal\Saved\SaveGames; the toolkit, on the other hand, is required to decode them.

I couldn't test the build: the Python interpreter configured on the PC was not found. Please recompile using the updated spec file. 0:43

Doesn't anything change if I just import them directly? 1:02

Yes, you can import them directly: PyInstaller can bundle palworld_save_tools into the EXE as regular Python modules, without copying the entire toolkit directory.

However, in your case, pyooz must also be included, as the parser uses it to decode the save files. So simply adding a single import statement isn't enough if PyInstaller fails to detect indirectly loaded modules.

The previous fix corrected the resource paths, but it didn't guarantee the parser would be included in the EXE. If you'd like, I can adjust the .spec file to collect both palworld_save_tools and pyooz directly into the build.


r/learnpython • • Oct 09 '26

I am newbe and I need for create exe with "folder" import

0 Upvotes
The structure of my project is as follows:
Python Modify HostName
->main.py
->palworld-save-toolkit
->->python ->[..]
->->vendor ->[..]

in vs code work all.

I know be exe with pyinstaaller but no work load toolkit and pyooz (?).

My partially code is (if need full code i load github today after work)

TOOLKIT_PY = RESOURCE_DIR / "palworld-save-toolkit" / "python"
VENDOR_PY = TOOLKIT_PY / "vendor"



def load_toolkit():
    """Import the toolkit's PlM/Oodle-aware parser ahead of any installed copy."""
    if not getattr(sys, "frozen", False):
        for path in (str(TOOLKIT_PY), str(VENDOR_PY)):
            if path not in sys.path:
                sys.path.insert(0, path)
    print(f"TOOLKIT_PY: {TOOLKIT_PY}")
    print(f"VENDOR_PY: {VENDOR_PY}")
    from palworld_save_tools.archive import UUID
    from palworld_save_tools.gvas import GvasFile
    from palworld_save_tools.palsav import compress_gvas_to_sav, decompress_sav_to_gvas
    from palworld_save_tools.paltypes import PALWORLD_CUSTOM_PROPERTIES, PALWORLD_TYPE_HINTS
    return UUID, GvasFile, compress_gvas_to_sav, decompress_sav_to_gvas, PALWORLD_CUSTOM_PROPERTIES, PALWORLD_TYPE_HINTS



def parse_player_roster(world: Path) -> list[dict[str, str]]:
    """Read player file IDs and names/levels from the world's Level.sav."""
    UUID, GvasFile, _, decompress, custom, hints = load_toolkit()
    players: dict[str, dict[str, str]] = {}
    for file in sorted((world / "Players").glob("*.sav")):
        with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):
            raw, _ = decompress(file.read_bytes())
            data = GvasFile.read(raw, hints, custom, allow_nan=True).dump()
        sd = data["properties"]["SaveData"]["value"]
        guid = file.stem.upper()
        players[guid] = {"guid": guid, "name": "", "level": "?"}
        instance_id = str(sd["IndividualId"]["value"]["InstanceId"]["value"])
        players[guid]["instance"] = instance_id

I ask gpt but not know how resolve

Why, when I compile the executable into an .exe, does it seem unable to read the save files? It’s as if it fails to load load_toolkit. 0:39

Work duration: 3m 39s

Yes, there were two path issues in the project:

The spec file PalWorldSwitchHostSaveGame.spec didn't include palworld-save-toolkit, so in the EXE load_toolkit() could fail because it couldn't find the parser.

Some paths used __file__, which in a PyInstaller EXE doesn't reliably identify the app's folder.

I updated [main.py](E:/chrig/Documenti/Palworlds saveames/PalWorldSwitchHostSaveGame/PythonModifySavegame/main.py) to distinguish between resources bundled inside the EXE and the app folder, and [PalWorldSwitchHostSaveGame.spec](E:/chrig/Documenti/Palworlds saveames/PalWorldSwitchHostSaveGame/PalWorldSwitchHostSaveGame.spec) to include both the toolkit and the icon. Palworld save files are looked up under %LOCALAPPDATA%\Pal\Saved\SaveGames; the toolkit, on the other hand, is required to decode them.

I couldn't test the build: the Python interpreter configured on the PC was not found. Please recompile using the updated spec file. 0:43

Doesn't anything change if I just import them directly? 1:02

Yes, you can import them directly: PyInstaller can bundle palworld_save_tools into the EXE as regular Python modules, without copying the entire toolkit directory.

However, in your case, pyooz must also be included, as the parser uses it to decode the save files. So simply adding a single import statement isn't enough if PyInstaller fails to detect indirectly loaded modules.

The previous fix corrected the resource paths, but it didn't guarantee the parser would be included in the EXE. If you'd like, I can adjust the .spec file to collect both palworld_save_tools and pyooz directly into the build.


r/learnpython • • Oct 09 '26

How do I start learning python?

0 Upvotes

For context I use arch and I have 5 different computers so I’m very familiar with computers and terminals/text. And my only coding experience I guess would be block coding which I learnt around 1st grade. Don’t laugh it off so quickly tho it gets complexly when you get into making 3d projects in something like scratch, it’s a whole community.

Besides that I have coded a little Unity 4 or so years ago and got fairly into c# but I never even finished a project. That connects directly to my question, I want to start learning python but how should I go about it? Should I start with yt toturials on how to make a game with turtle? Or should I pick a project I wanna make and start googling or using AI for help (not copy n paste). Or any other option?


r/learnpython • • Oct 09 '26

Looking for a certification in Python

2 Upvotes

I would like to ask if anyone here knows where I should/could get a well endorsed Python certification? Something legit that employers may take into consideration.

I know about Codecademy. I also know about Mimo, tho I don't know if that one would be considered a "lesser" one or something like that. Maybe even both idk.

It's ok if it's not free, tho if its not very expensive that would be better for me lol


r/learnpython • • Oct 08 '26

Curated, Instructor led course for team?

1 Upvotes

Hi All,

I work with a team that will primarily be using Python to make API calls across a few different systems (some network, some apps, ServiceNow, etc).

I'm trying to find a crash course, preferably instructor led, that's a little focused on our particular use case.

Any recommendations? I know it's a weird ask.


r/learnpython • • Oct 08 '26

Hidden Python permission in macOS Local Network. How can I revoke it?

0 Upvotes

On macOS 27.0.1, Privacy & Security → Local Network shows a count of 1, but every listed app is switched off.

Inspecting /Library/Preferences/com.apple.networkextension.plist reveals an allowed org.python.python entry with no executable path. Python has no visible switch in Settings. Reopening Settings and restarting don’t help.

I allowed a Python prompt while a dashboard preview was being prepared. A Time Machine backup from before that prompt has no explicit Python grant.

Has anyone encountered this and successfully revoked only that permission, without resetting all network?


r/learnpython • • Oct 08 '26

Looking for some advice/info about using AI with Python

0 Upvotes

Hi everyone! I’m working on a project in Python and I’m looking for an AI model/API that my Python application can communicate with. Basically, I need my app to be able to send questions/prompts to the AI and receive the AI’s responses back programmatically.

The AI doesn’t necessarily need to be the most powerful model available. I mainly need something reliable that my application can communicate with.

Any recommendations or advice would be greatly appreciated!


r/learnpython • • Oct 08 '26

I just started learning Python — what should I build after learning the basics?

52 Upvotes

I recently started learning Python and I'm currently focusing on the fundamentals rather than jumping straight into advanced topics.

I'm learning things like variables, strings, numbers, conditions, loops and functions.

I want to start building small projects as soon as I have enough fundamentals instead of only following tutorials.

For someone at this stage, what projects would you recommend that actually help build programming skills?

I'd especially like projects that gradually become more challenging.


r/learnpython • • Oct 08 '26

Learn python and DSA

0 Upvotes

I started python and it is going well. I need some sources for step by step problems with increasing difficulty for practice. It would be good to know list of topics as part of DSA too

Leetcode is too good but I am too under-learned to solve those.

Thanks in advance 🙏🙏


r/learnpython • • Oct 08 '26

(Python Crash Course, ch11) Why pytest does throw an assertion error

1 Upvotes

name_function.py:

def get_formatted_name(first, last):

full_name=f"{first} {last}"

return full_name.title

test_name_function:

from name_function import get_formatted_name

def test_first_last_name():

formatted_name=get_formatted_name("janis", "joplin")

assert formatted_name=="Janis Joplin"

Terminal:

/storage/emulated/0 $ cd github

/storage/emulated/0/github $ cd test_name_function

/storage/emulated/0/github/test_name_function $ python -m pytest

===================== test session starts =====================platform linux -- Python 3.13.13, pytest-9.1.1, pluggy-1.6.0

rootdir: /storage/emulated/0/github/test_name_function

collected 1 item

test_name_function.py F [100%]

========================== FAILURES ===========================____________________ test_first_last_name _____________________

def test_first_last_name():

formatted_name=get_formatted_name("janis", "joplin")

> assert formatted_name=="Janis Joplin"

E AssertionError: assert <built-in method title of str object at 0x7108e84530> == 'Janis Joplin'

test_name_function.py:4: AssertionError

====================== warnings summary =======================../../../../../data/user/0/ru.iiec.pydroid3/app_HOME/.local/lib/python3.13/site-packages/_pytest/cacheprovider.py:469

/data/user/0/ru.iiec.pydroid3/app_HOME/.local/lib/python3.13/site-packages/_pytest/cacheprovider.py:469: PytestCacheWarning: could not create cache path /storage/emulated/0/github/test_name_function/.pytest_cache/v/cache/nodeids: [Errno 1] Operation not permitted: '/storage/emulated/0/github/test_name_function/pytest-cache-files-uabqyvch' -> '/storage/emulated/0/github/test_name_function/.pytest_cache'

config.cache.set("cache/nodeids", sorted(self.cached_nodeids))

../../../../../data/user/0/ru.iiec.pydroid3/app_HOME/.local/lib/python3.13/site-packages/_pytest/cacheprovider.py:423

/data/user/0/ru.iiec.pydroid3/app_HOME/.local/lib/python3.13/site-packages/_pytest/cacheprovider.py:423: PytestCacheWarning: could not create cache path /storage/emulated/0/github/test_name_function/.pytest_cache/v/cache/lastfailed: [Errno 1] Operation not permitted: '/storage/emulated/0/github/test_name_function/pytest-cache-files-k26w91m_' -> '/storage/emulated/0/github/test_name_function/.pytest_cache'

config.cache.set("cache/lastfailed", self.lastfailed)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

=================== short test summary info ===================FAILED test_name_function.py::test_first_last_name - AssertionError: assert <built-in method title of str objec...

================ 1 failed, 2 warnings in 2.57s ================/storage/emulated/0/github/test_name_function $


r/learnpython • • Oct 08 '26

Learning python for data science/analysis

18 Upvotes

Hi everyone,

I am looking for a good course to take to learn python for data analytics and workflow building.

For context, i am already very familiar with SQL and Alteryx, however i am looking to migrate some pipelines and worklows to python. I am very familiar with data analytics, just not with the python language, so wondering where to start.


r/learnpython • • Oct 08 '26

Brython Offline - A single .html file with a Python interactive shell

4 Upvotes

GitHub: https://github.com/asweigart/brython-offline

Demo: https://inventwithpython.com/brython-3.14.3-offline.html

Powered by Brython. Download and open brython-3.14.3-offline.html (6 MB) in a web browser and enter Python instructions into the interactive shell. It works offline. No ads, no registration, no subscriptions. You can right-click and save it and own it forever.


r/learnpython • • Oct 08 '26

Data inspection steps using python

2 Upvotes

I am learning data analysis and the first step before analyzing your data you have to do data profiling and cleaning.This is my process flow for data profiling -

  1. Checking number of rows and columns
  2. Checking rows and column indices
  3. Checking data types for each column
  4. Checking random sample from dataset
  5. Checking properties and memory usage
  6. Checking key statistics
  7. Checking unique values for relevant columns

Is it appropriate or I am missing something important ?


r/learnpython • • Oct 08 '26

want study

0 Upvotes

I’d like to ask what keeps you motivated to keep learning Python. What are the steps to learn Python? Could you share some with me? I’m a college student learning C in class and want to self-study Python in my spare time. I also want to know how I can test my Python skills.


r/learnpython • • Oct 08 '26

logging and timing...then getting rid of it

1 Upvotes

I was just working on a project where I included a lot of logging and timing decorators/context managers (it involved event loops and async queues and such). Once I figured stuff out, I wanted to remove all this stuff. This isn't necessarily that hard, but it did make me wonder if there's a better way to do this in the first place. I suppose I'm imaging some way of marking these code pieces to be ignored by the interpreter or something?

(yeah yeah "ask AI to remove it")


r/learnpython • • Oct 07 '26

How to create universal variables in Python?

0 Upvotes

And by universal variables, I mean they should be available in EVERY single Python script!

What do I want these for? For instance, to define default directories:

HTMLRoot = "C:/IMDb/HTML" CSSDir = "file:///C:/IMDb/CSS/" JSDir = "file:///C:/IMDb/JavaScript/"

Any program that creates a report needs these variables, but I only want to define them once!

And there’s more. I also have plenty of mappings, like these:

MapC_TType = {"tvSeries": "TV Series", "tvMiniSeries": "TV Miniseries", ... , "movie": "Movie", "video": "Video", }

Any report that displays the titleType will use this mapping. Again, I only want to define the mapping once.

I come from the world of SAS, where everything was easy. The directories were defined in the SASINIT file, which is executed at the start of every SAS session. The mappings (formats) were stored in a permanent SAS catalog, making them universally available as well. Is there a Python equivalent?

And there’s even more. I create lots of reports, let’s say the biggest movies per decade, based on number of votes or score (= votes * rating). Obviously, the list shows which movies I’ve seen and which I haven’t, with a percentage showing my progress. Now suppose a friend wants this same list, based on the movies he’s seen.

Easy-peasy in SAS!

%macro SwitchUser (User) ; %if (%qupcase(&User) = ME) %then %do ; libname IMDb "C:\IMDb\Libname IMDb" ; %let HTMLRoot = C:\IMDb\HTML ; %end ; %else %do ; libname MyIMDb "C:\IMDb\Libname IMDb" ; libname BudIMDb "C:\IMDb\Libname IMDb Bud" ; libname IMDb (BudIMDb MyIMDb ) ; %let HTMLRoot = C:\IMDb\HTMLBud ; %end ; %mend ;

For me, IMDb is the standard library. For my buddy, IMDb is a concatenated library, where his library (containing only the MyMovies table) has precedence over the full IMDb library.

By just executing

%SwitchUser (Buddy) ;

any report can now be run against his list of movies, with the results written to a separate HTML directory. And all that without changing a single line of code!

I can't expect Python to deliver all this functionality. Nothing compares to SAS! But can it at least do some basic things on my wishlist?

BTW, my temporary solution is to include this code at the start of every script:

PythonFolder = Path("C:/IMDb/Python Global Code") PythonPgm = PythonFolder / "InitHTML.py" with open(PythonPgm, 'r') as file: PythonCode = file.read() exec(PythonCode, globals=globals(), locals=locals())

Obviously, the InitHTML program defines the directories and all the mappings.


r/learnpython • • Oct 07 '26

Help needed with a python code

0 Upvotes

Hello, fellow redditors. I am using manychat program with automations connected to my instagram profile.

When people are using the keyword to get certain information, they need to leave a name and number to be contacted. However, the number can't be identified due to a bad variables and invalid JSON.

Could maybe someone help who is familiar with situations like this please?

I think it might be a manychat bug, however i need a opinion from someone experienced.

Thank you a lot!