python create a script that looks through weapons.meta files that are within folders in…
- User
python create a script that looks through weapons.meta files that are within folders in a base folder the open the weapons.meta and find the text WEAPON_ and append the WEAPON_name to a txt document
here is a an example of what the weapons.meta file looks like
In this example I was want it to return and add WEAPON_AK971 to the txt document
- Assistant
Here's a Python script that extracts the "WEAPON_" names from weapons.meta files and appends them to a txt document:
python - User
File "t:\Fivem Related\Alpha Dev\test.py", line 16, in tree = ET.parse(os.path.join(root, file))
xml.etree.ElementTree.ParseError: XML declaration not well-formed: line 1, column 33
- Assistant
Sorry about the issue you're encountering. The error mentioned is due to an improperly formatted XML declaration. It seems there is an issue with the XML declaration in the
weapons.metafile you're working with.To bypass this issue, you can modify the script to read the file content and remove the XML declaration before parsing the content.
Please find below the modified script:
python