Pox: Filesystem Utilities
Pox is a Python library offering simple utilities for exploring and manipulating local and remote filesystems, and for automated build processes. It is currently at version 0.3.7 and maintains an active development status with regular minor updates.
Common errors
-
ImportError: No module named pox.core
cause This error often occurs when the POX library is not correctly installed as a Python package, or when there's a mismatch between the import statement and the actual directory structure, especially after cloning the repository directly. It can also stem from Python 2 vs. Python 3 compatibility issues, as older POX versions primarily supported Python 2.7.fixIf installing via Git, ensure `__init__.py` files exist in relevant directories. If your project is a subdirectory of the cloned `pox` repository, you might need to adjust imports from `from pox.core import ...` to `from pox.pox.core import ...`. For modern `pox` (uqfoundation), ensure Python 3.9+ is used and install with `pip install pox`. For older `pox` (noxrepo), use Python 2.7. -
AttributeError: 'IPAddr' object has no attribute 'split'
cause This error occurs when attempting to use string manipulation methods, such as `split()`, directly on an `IPAddr` object from `pox.lib.addresses`. The `IPAddr` object represents an IP address but is not a native Python string type.fixConvert the `IPAddr` object to its string representation first using the `.toStr()` method before applying string operations. For example, `st.toStr().split('.')` instead of `st.split('.')`. -
WARNING:version:Support for Python 3 is experimental.
cause This warning indicates that you are likely running an older version of POX, which was originally developed for Python 2.7, with a Python 3 interpreter. While some functionality might work, core components or dependencies may not be fully compatible, leading to unexpected behavior or further errors.fixFor older POX distributions (e.g., `noxrepo/pox`), use a Python 2.7 interpreter. If you intend to use POX with Python 3, ensure you are using the actively maintained `pox` library from the `uqfoundation` project, which supports Python 3.9+. -
AttributeError: 'YourControllerClass' object has no attribute 'connection'
cause This `AttributeError` typically arises in POX when a custom controller component or module tries to access an attribute like `connection` directly from its own instance (`self.connection`), but `connection` is actually an attribute of an event object (e.g., `event.connection`) that is passed to event handler functions within the controller.fixEnsure that you are accessing the `connection` attribute from the `event` object provided to your event handler. For instance, if you have an `_handle_PacketIn` method, use `event.connection.send(fm)` instead of `self.connection.send(fm)`.
Warnings
- breaking Pox dropped formal support for Python 3.7.
- breaking The minimum required Python version was increased from 3.7 to 3.8.
- breaking The minimum required Python version was further increased from 3.8 to 3.9.
- breaking The `pox` module does not expose a `version()` method as part of its public API, leading to an `AttributeError` when `pox.version()` is called.
- breaking The `pox.version()` method is not available or has been removed from the `pox` library's API, leading to an `AttributeError`.
Install
-
pip install pox
Imports
- pox
import pox
Quickstart
import pox
# Get the library version
print(f"Pox Version: {pox.version()}")
# Display the license information
print("\n--- License ---")
print(pox.license())
# Display citation information
print("\n--- Citation ---")
print(pox.citation())