Log 2/100: Telnetting into the Switch Python Library: telnetlib Today, I wrote a script to Telnet into my lab switch, but it kept crashing. After some troubleshooting, I found the exact issue: Python is just too fast. The script kept pasting the username before the switch had even generated the login prompt. The Fix: I added an extra line to the script (read_until) to force Python to wait and read the output until it actually saw the word "login:", and then asked it to paste the username. I applied the same logic to the Password prompt as well. Suddenly, the script started working flawlessly. The Takeaway: Writing the code is the easy part. Anticipating timing issues and making sure the script actually works without breaking in production is the tough part! The scirpts executes the show version command on the switch. Git Hub Repo: https://lnkd.in/gFkfNyWm Git hub Profile: https://lnkd.in/gjJJJQeT #Python #NetworkAutomation #NetDevOps #NetworkEngineering #100DaysOfCode #ArubaCX #CodingJourney
Telnet Script Fix: Anticipating Timing Issues in Python
More Relevant Posts
-
I’ve been spending my recent free time in building an Event-Driven Backtesting Engine from scratch for Options. Backtesting complex option strategies requires processing massive amounts of market data, calculating Greeks, and tracking portfolio metrics simultaneously. To handle this without latency bottlenecks, I decided to architect the entire core engine in C++. for now I have mostly tried to make it very flexible like modular commission and slippage and ability to write custom strategies instead of editing the core engine itself I completely decoupled most of the core things so The entire C++ backend is compiled as a standalone library. I am also trying to Integrate a python bridge using pybind11 exposing this compiled library directly to Python. The goal for this is to make the engine to do all the computation in the background, allowing anyone to write, test, and plug in custom strategies dynamically using simple Python scripts without ever needing to modify the core engine files. Getting the C++ event loop to work good with Python scripting is proving to be a little complicated right now! I'll be pushing a final README and some sample strategies once I get the bindings fully stabilized. You guys can check out the code here : https://lnkd.in/gRSgd4gs #quantfinance #cpp #python #algorithmictrading #options #pybind11 #derivatives
To view or add a comment, sign in
-
-
We had 4 coding agents port the same Python service to Go. One of the ports compiled, started, served valid HTTP responses, and passed its test suite. It also never fetched any data. A function that reads an HTTP response body was reading into an empty buffer, so it read zero bytes every time. No linter catches it because the types are correct. The tests pass because they only check that the result is not empty. Both the code and the tests look fine until you actually try to use it. More: https://lnkd.in/dvHWsnB2
To view or add a comment, sign in
-
pip 26.1 Just Released For anyone that uses #pip for #Python package installations, uninstalls, etc - it has been updated today. This upgrade includes: dependency resolution performance improvements, reduced memory usage, improved conflict reports, etc. To upgrade pip, perform the following command. python -m pip install --upgrade pip For a list of enhancements and bug fixes, see as follows: https://lnkd.in/enhpRgnX
To view or add a comment, sign in
-
VSCode workspace is a game changer! If you're writing Python codes for different versions (2.* and 3.*), then you should try the workspace in VSCode. Basically with workspace, you can define/set which CPython version to use when you click the play/run button in VSCode. This is very useful in cases where you might be trying out a logic in Python 2 and also on Python 3, or when you're migrating either upwards (from 2 to 3) or downwards (from 3 to 2), and since it's on the same IDE, the experience is really enjoyable. This also works on the same major version, so maybe you have Python 2.2 and 2.7, or 3.10 and 3.13; and it's not limited to just 2, you can have more. First time I tried it, had me smiling :) cause I work on different versions and it's not fun going to console and manually typing which python version to run on which folder --- (side note: python launcher is a great tool, but having an IDE that can support multiple versions seamlessly is just another level of ease). I really liked it, try it and see for yourself ;) #vscode #workspace #dcm #python
To view or add a comment, sign in
-
My biggest mistake early in my Python journey wasn’t bad code. It was ignoring the small tools that make systems reliable. After 4+ years building automation projects, I found a handful of libraries that quietly transformed my side projects into production-ready products. I wrote about the exact 8 libraries I rely on today. Check out the full breakdown on my Medium account.
To view or add a comment, sign in
-
Python scope is one of those topics that separates developers who debug fast from those who don't. The language gives you no warning when a variable resolves to an unexpected value. It simply executes, returns a result, and moves on. Tracking down the source of that behaviour - without a solid mental model of how Python resolves names - can cost hours. The LEGB rule isn't complicated. But it's rarely taught with the depth it deserves. I wrote a free guide to change that: → How Python's name resolution actually works under the hood → The LEGB lookup chain with concrete, practical examples → Enclosing scopes and closure behaviour explained clearly → When global and nonlocal are appropriate - and when they signal a design problem → The scope patterns most likely to introduce silent bugs in real codebases Download it free: https://lnkd.in/djp6HJdD #Python #SoftwareEngineering #PythonDevelopment #BackendDevelopment
To view or add a comment, sign in
-
🚀 Just Published My First Python Library on PyPI! Excited to share that I’ve built and published "common-fun" — a modular Python utility library designed to simplify everyday development tasks. 📦 Install: pip install common-fun 🖥️ Try CLI: common-fun help 🔗 GitHub: https://lnkd.in/gjWRyhpq 🔧 What it includes: • Number utilities (prime, gcd, factorial, etc.) • String processing (palindrome, slugify, etc.) • Array helpers (flatten, chunk, rotate) • Validators (email, URL, password) • File utilities • Performance decorators (timer, retry, caching) • 🔥 CLI support for direct terminal usage 💡 Why I built this: While working on multiple projects, I realized I was repeatedly writing similar utility functions. So I decided to consolidate everything into a clean, reusable, and structured library. ⚙️ Key highlights: • Fully modular architecture • Optimized implementations • CLI tool for quick access • PyPI-ready packaging • Clean documentation This project helped me understand: ✔️ Library design ✔️ Packaging & publishing ✔️ CLI development ✔️ Clean code practices Would love your feedback and suggestions! #Python #OpenSource #Developer #Programming #PyPI #SoftwareDevelopment
To view or add a comment, sign in
-
⚡ Meet Ty: The New Generation Python Type Checker by Astral If you're still using traditional type checkers and feeling the slowdown 👉 it might be time to look at ty Built by the team behind ruff and uv, ty is a blazingly fast Python type checker and language server written in Rust 💡 Why Ty is getting attention ✅ Extremely fast compared to traditional tools ✅ Works as both a type checker and a language server ✅ Rich and actionable diagnostics ✅ Handles partially typed codebases well ✅ Near-instant feedback with incremental analysis 🔍 What makes it really interesting Ty is not just about speed It also introduces advanced typing capabilities like • Intersection types • Smarter type narrowing • Better reachability analysis 🔥 The bigger picture Astral is building a full Python tooling ecosystem ruff for linting uv for packaging ty for type checking 📦 If you care about performance and modern Python tooling, this is definitely one to watch 👉 GitHub repo: https://lnkd.in/eNB37cVa #Python #DataEngineering #TypeChecking #DeveloperTools #Programming #Astral
To view or add a comment, sign in
-
-
One thing that significantly improved my Python code quality: Static analysis is not optional at scale. For a long time, I relied on code reviews to catch issues. Eventually, I realized something: 👉 Humans are bad at consistently spotting patterns. 👉 Tools are not. That’s where static analysis changed everything. Without running the code, these tools analyze your source and detect: bugs code smells complexity issues type inconsistencies All before production The combination that worked best for me: Ruff → fast linting and code quality Replaces multiple tools (flake8, isort, etc.) and runs extremely fast Mypy → type checking Uses type hints to catch bugs before runtime, bringing discipline to Python’s dynamic nature Radon → complexity analysis Measures cyclomatic complexity and highlights functions that are hard to maintain. #Python #StaticAnalysis #BackendEngineering #Django #CleanCode #SoftwareEngineering #DevOps
To view or add a comment, sign in
-
-
Today’s Python lesson felt like the moment code stopped being just instructions and started feeling reusable, flexible, and kind of smart. 🐍 Day 14 of my #30DaysOfPython journey was all about higher order functions, and this one made Python feel a lot more powerful. In Python, functions are first-class citizens, which means they can: 1. take other functions as parameters 2. return functions as results 3. be modified 4. be assigned to variables Today I also explored: 1. Functions as parameters 2. Functions as return values 3. Closures — where an inner function can use the outer function’s scope 4. Decorators — a clean way to add extra behavior without changing the original function 5. Built-in higher order functions like: i. map() → transforms items ii. filter() → keeps only matching items iii. reduce() → combines items into one value What stood out to me today was how Python lets functions do more than one job. They are not just blocks of code anymore — they can actually shape how other code behaves. One more day, one more topic, one more step toward thinking in cleaner, more reusable logic. Which one feels the most interesting to you right now: map(), filter(), reduce(), or decorators? Github Link - https://lnkd.in/gc-mj8Qi #Python #LearnPython #CodingJourney #30DaysOfPython #Programming #DeveloperJourney
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development