Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#1161 closed defect (fixed)

make-messages.py fails in win32 for long folders

Reported by: hipertracker@… Owned by: hugo
Component: Internationalization Version: master
Severity: critical Keywords: i18n, win32 unique-messages.py
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The script make-messages.py does not work for long folders (containing spaces) in win32

SOLUTION:

For win32:

    stdin, stdout, stderr) = os.popen3('msguniq %s' % potfile, 'b')

should be changed to:

if sys.platform == 'win32':	
    stdin, stdout, stderr) = os.popen3('msguniq "%s"' % potfile, 'b')

and

    (stdin, stdout, stderr) = os.popen3('msgmerge -q %s %s' % (pofile, potfile), 'b')

should be changed to:

    if sys.platform == 'win32':	
        (stdin, stdout, stderr) = os.popen3('msgmerge -q "%s" "%s"' % (pofile, potfile), 'b')

Change History (7)

comment:1 Changed 10 years ago by hugo

Uh - where do you get paths with spaces in them? Python module paths should never contain spaces, and the templates are usually just stored within the project path. Makes me really wonder where the space comes in. Actually the problem isn't just with Windows - it's a common problem with constructing command lines when spaces in filenames come into play, but the situation where this happens shouldn't have spaces, that's why I am curious :-)

comment:2 Changed 10 years ago by hugo

  • Resolution set to fixed
  • Status changed from new to closed

(In [1814]) fixes #1161 - spaces in filenames should now be handled better (filename parameters are enclosed in "")

comment:3 Changed 10 years ago by hipertracker@…

  • Keywords unique-messages.py added; make-messages.py removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

The same problem is also in unique-messages.py file.

Change

cmd = 'msguniq %s.po' % pf

to

cmd = 'msguniq "%s.po"' % pf

And this is not problem o Python modules o course.

comment:4 Changed 10 years ago by hugo

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [1821]) fixes #1161 - added quotes to unique-messages.py

comment:5 Changed 10 years ago by hugo

I'm still interested on where you get spaces in filenames within your Django project.

Oh, and the unique-messages.py is usually only needed by devs managing branches. No need for normal users to make use of it (it's there to handle a special case of problem that happens when merging .po files between branches).

comment:6 Changed 10 years ago by verbosus

Since on lines 15 and 17 in source:/django/trunk/django/bin/make-messages.py we’re calling:

os.path.abspath()


Maybe he’s getting spaces from his own “C:\Documents and Settings\…” directory?

comment:7 Changed 10 years ago by hugo

ah, yes, that's possible. thx for the info.

Note: See TracTickets for help on using tickets.
Back to Top