Skip to main content

pyFFEDITC

GitHub release (latest by date) Python 3.6+ License GNU GPL v3

This Python module wraps the ffeditc_unicode.exe utility. The module allows you to compress and decompress MSTS files such as shape and world files.

[!IMPORTANT] This module requires ffeditc_unicode.exe from Microsoft Train Simulator (MSTS). It is not included with this Python module. You must provide the executable from your own MSTS installation.

See also:

  • pytkutils - handles compression and decompression of MSTS files such as shape and world file through the TK.MSTS.Tokens.dll library by Okrasa Ghia.

Prerequisites

To use this Python module you must supply the ffeditc_unicode.exe utility found in MSTS installations. It is not included with the module.

Linux-specific prerequisites

On Linux you need Wine installed.

To install Wine on Debian-based distros:

dpkg --add-architecture i386
apt update
apt install wine64 wine32

Then create the Wine directory:

export WINEPREFIX="$HOME/.wine"
export WINEARCH=win64

wineboot -u

Now ffeditc_unicode.exe can be run via Wine:

wine path/to/ffeditc_unicode.exe

The Python module will automatically attempt to use Wine on Linux.

Installation

Install from PyPI

pip install --upgrade pyffeditc

Install from wheel

If you have downloaded a .whl file from the Releases page, install it with:

pip install path/to/pyffeditc-<version>‑py3‑none‑any.whl

Replace <version> with the actual version number in the filename.

Install from source

git clone https://github.com/pgroenbaek/pyffeditc.git
pip install --upgrade ./pyffeditc

Usage

Check if a file on disk is compressed

To check whether a file on disk is compressed, you can use the is_compressed function. This function returns True if the file is compressed and False if it is not. If the file is empty or its state cannot be determined, the function will return None.

import pyffeditc

compressed = pyffeditc.is_compressed("./path/to/example.s")

if compressed is True:
    print("Compressed")
elif compressed is False:
    print("Uncompressed")
else:
    print("Could not determine (possibly empty file)")

Compress or decompress files

The compression and decompression functions in this module use the ffeditc_unicode.exe utility found in MSTS installations. This utility is not included with the Python module.

Alternatively, you can use pytkutils. But note that only compression appears to work properly using the TK.MSTS.Tokens.dll library by Okrasa Ghia.

You can also compress/decompress manually using ffeditc_unicode.exe through the Shape File Manager or use the FFEDIT_Sub v1.2 utility by Ged Saunders.

import pyffeditc

ffeditc_path = "./path/to/ffeditc_unicode.exe"

# Compress and decompress in-place.
pyffeditc.compress(ffeditc_path, "./path/to/example.s")
pyffeditc.decompress(ffeditc_path, "./path/to/example.s")

# Compress and decompress to an output file.
pyffeditc.compress(ffeditc_path, "./path/to/example.s", "./path/to/output.s")
pyffeditc.decompress(ffeditc_path, "./path/to/example.s", "./path/to/output.s")

Running Tests

You can run tests manually or use tox to test across multiple Python versions.

Run Tests Manually

First, install the required dependencies:

pip install pytest pytest-dependency

Then, run tests with:

pytest

Run Tests with tox

First, install the required dependencies:

pip install tox pytest pytest-dependency

Then, run tests with:

tox

This will execute tests for all Python versions specified in tox.ini.

Contributing

Contributions of all kinds are welcome. These could be suggestions, issues, bug fixes, documentation improvements, or new features.

For more details see the contribution guidelines.

License

This Python module was created by Peter Grønbæk Andersen and is licensed under GNU GPL v3.

Metadata

Release files for pyffeditc 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyffeditc 0.1.3
File Size Uploaded
pyffeditc-0.1.3.tar.gz 20.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyffeditc 0.1.3
File Interpreter ABI Platform
pyffeditc-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 43.1 kB

Release files / pyffeditc-0.1.3.tar.gz

Download URL pyffeditc-0.1.3.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
98a013bd45b95f22d6f42b2388ddf381f35a0e9042cda3a8e61f4f9d7cff6468
BLAKE2b-256 checksum
How to use checksums
4f680cb3d8c482abfa24530c3397c2db0aa963310df4ec0c7362a78dff95d4fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / pyffeditc-0.1.3-py3-none-any.whl

Download URL pyffeditc-0.1.3-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37e12a9d917f1b8c85d8e2c3b113dc51de618d59e19d1509c55de2c56c3e00ce
BLAKE2b-256 checksum
How to use checksums
d0f07dc946dd95f3feb405061f6f85873f95267fb05f80496b281205808955ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page