Comments (12)
For the time of writing, both master and 1.18 branches (you didn't say what code you're using), I observe line 27 of https://github.com/wesnoth/wesnoth/blob/master/data/tools/pywmlx/state/wml_states.py to be a comment block.
Can you try removing that block and see if it still complains? If it's not required, I generally advise code-disabled-by-comments to be removed altogether - that's what source control is for.
from wesnoth.
A couple months ago there was a very similar report from Iris also for wmlxgettext and Python 3.12:
18:25:31 iris@mia ~/Projects/Project Ethea/Ethea-i18n git:master % make pot-update
POT wesnoth-Invasion_from_the_Unknown.pot
Traceback (most recent call last):
File "/Users/iris/Local/bin/wmlxgettext", line 41, in <module>
import pywmlx
File "/Users/iris/Projects/wesnoth/data/tools/pywmlx/__init__.py", line 13, in <module>
import pywmlx.state as statemachine
File "/Users/iris/Projects/wesnoth/data/tools/pywmlx/state/__init__.py", line 1, in <module>
from pywmlx.state.machine import setup
File "/Users/iris/Projects/wesnoth/data/tools/pywmlx/state/machine.py", line 165
value = re.sub('\\\s*$', '', value)
^^^^^^^^
SyntaxError: (value error) not enough values to unpack (expected 2, got 1)
make: *** [Invasion_from_the_Unknown/wesnoth-Invasion_from_the_Unknown.pot] Error 1
which was fixed in 4be9aa8.
from wesnoth.
Indeed deleting the comment solves it. Will push that later.
Interesting that this happens.
from wesnoth.
At first glance I thought maybe the interpreter wasn't accepting comment blocks at a different indentation level to what is the then-current class block (for WmlIdleState
). But it is strange that the current Python triggers an exception on this, but previous ones don't (maybe a deliberate design decision?).
from wesnoth.
I observe line 27 of https://github.com/wesnoth/wesnoth/blob/master/data/tools/pywmlx/state/wml_states.py to be a comment block.
Line 27 isn't a comment block, which in Python don't exist. It's code wrapped inside a multi-line string, so rules for escape characters still apply there. Does marking the string as raw solve the issue?
But it is strange that the current Python triggers an exception on this, but previous ones don't (maybe a deliberate design decision?).
Yes, it's a deliberate decision, although it should only raise a SyntaxWarning
for now instead of a SyntaxError
: https://docs.python.org/3/whatsnew/3.12.html.
from wesnoth.
I'm still relatively new to Python so I might not know the exact terminology, but clearly the intention was to disable code as a comment - regardless of the syntactic detail, I already said this practice isn't good.
Edit: Oh I see what you mean - the regular expression inside the code may have triggered SyntaxError.
from wesnoth.
Exactly. Every point of a string where there's a backslash can generate this kind of problem, because it starts an escape sequence, so that's why I suggested marking the string as raw: it forces backslashes to be interpreted as literal characters.
I'd try to fix it, but on Ubuntu 22.04 I don't have access to Python 3.12 (in the repositories there's 3.11 at most) and forcing an update to 24.04 before the first point release is available isn't recommended (there's an issue that can make Thunderbird unusable). It's better if someone else checks the fix.
from wesnoth.
I use Mint, so it'll probably be at least a couple months until they have a version that's based on Ubuntu 24.04 available.
from wesnoth.
I'm still waiting for proper ROCm support for Ubuntu 24.04 before switching to it. ):
from wesnoth.
I tested Python 3.11 and 3.12 in Windows, confirmed the issue as reported, and confirm changing the block to a raw string resolves the issue without apparent change for Python 3.11.
I'd make a PR for this, but I'm still inclined to just remove the whole block instead.
from wesnoth.
If it's just unused code and not meant as an example or to be part of documentation, then I think removing it is fine. Boggles my mind that Python doesn't have actual code comments though...
from wesnoth.
Boggles my mind that Python doesn't have actual code comments though...
It has comments, just not block comments.
from wesnoth.
Related Issues (20)
- tooltips being recreated on every mouse move HOT 10
- MP Campaigns: ``leader_lock=yes`` when no ``type=`` defined HOT 6
- editor: Save into addon when saving a scenario HOT 6
- editor: Pick proper dir and filename in Save Map/Scenario As dialog HOT 10
- EI: Baneblade Item's Weapon Has a Hidden "Always Use On Defence" Effect That Should be Included in its Description HOT 2
- URL hitboxes on centered text are left-aligned HOT 1
- WFL referencing unit variables strange number manipulation HOT 3
- Make elevation terrain invisible on the minimap
- Images placed with `[item]` remain on the map when resetting a replay HOT 2
- Exception caught too late when opening a help page with invalid utf8 HOT 1
- Campaignd should tell UMC authors to rename MyAwesomeAddon HOT 4
- [object] can carry garbage data to next scenario HOT 6
- Deprecate [filter_weapon] in weapon special unit filters HOT 8
- Weapon special filters can be affected by the weapon special leading to infinite recursion HOT 4
- Disscussion on Title Screen Background ideas HOT 6
- In MP games with Plan Mod enabled Undo doesn't work for the first action of a turn even if no fog/shroud update
- Class invariants of attack_type and attack_type::specials_context_t HOT 3
- wesnoth.sync.evaluate_single HOT 5
- Improve wesnoth.interface.select_unit()
- API missing from emmylua
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wesnoth.