{"id":28320,"library":"tcxfile","title":"tcxfile","description":"A library for reading and writing TCX (Training Center XML) files, commonly used for GPS fitness data. Current version 1.0.4, supports Python >=3.0, released under MIT license. Stable, low release cadence.","status":"active","version":"1.0.4","language":"python","source_language":"en","source_url":"https://github.com/tcgoetz/Tcx","tags":["tcx","fitness","xml","gps"],"install":[{"cmd":"pip install tcxfile","lang":"bash","label":"Install tcxfile from PyPI"}],"dependencies":[],"imports":[{"note":"TcxReader is a class, not a module; use from import.","wrong":"import tcxfile.TcxReader","symbol":"TcxReader","correct":"from tcxfile import TcxReader"},{"note":"TcxWriter is a class; incorrect import leads to AttributeError.","wrong":"import tcxfile.TcxWriter","symbol":"TcxWriter","correct":"from tcxfile import TcxWriter"}],"quickstart":{"code":"from tcxfile import TcxReader\n\n# Read a TCX file\ntcx = TcxReader('path/to/activity.tcx')\nprint(tcx.read())\n\n# Write a TCX file\nfrom tcxfile import TcxWriter\ntcx_writer = TcxWriter('output.tcx')\ntcx_writer.write({'Activities': []})\n","lang":"python","description":"Basic read and write TCX files."},"warnings":[{"fix":"Use tcx.read()['Activities'] to iterate over activities.","message":"TcxReader.read() returns a dictionary, not an object. Access data via dict keys like ['Activities'].","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure the dict has an 'Activities' key containing a list of activity dicts.","message":"TcxWriter.write() expects a dict structure; providing an empty list will produce an invalid TCX file without an Activities element.","severity":"deprecated","affected_versions":"all"},{"fix":"Access raw XML via TcxReader.tree if needed.","message":"TCX files may contain trackpoints with multiple extensions. tcxfile does not parse extensions by default.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Replace 'import tcxfile' with 'from tcxfile import TcxReader'","cause":"Using import tcxfile instead of from tcxfile import TcxReader","error":"AttributeError: module 'tcxfile' has no attribute 'TcxReader'"},{"fix":"Check file path and existence before reading, or use tcx.read() or {}.","cause":"Trying to read a non-existent or empty TCX file, read() returns None","error":"TypeError: 'NoneType' object is not subscriptable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}