Ticket #164 (closed defect: fixed)

Opened 5 years ago

Last modified 3 years ago

error run "paster serve --reload"

Reported by: ibear Owned by: ianb
Priority: normal Milestone: 1.3
Component: script Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

I have met a error under winxp, pastescript1.3.1dev_r6313-py2.5. When I run "paster serve --reload development.ini" under pylons project folder, a error of "WindowsError?: [Error 22]" will raise.

I checked the pastescript's serve.py, and found something maybe wrong in restart_with_monitor:

        ...
        while 1:
            args = [sys.executable] + sys.argv
            if sys.platform == "win32":
                args = ['"%s"' % arg for arg in args]
            new_environ = os.environ.copy()
            if reloader:
                new_environ[self._reloader_environ_key] = 'true'
            else:
                new_environ[self._monitor_environ_key] = 'true'
            proc = None
            try:
                proc = subprocess.Popen(args, env=new_environ)
                exit_code = proc.wait()
            except KeyboardInterrupt:
                print '^C caught in monitor process'
            ...

I think args = ['"%s"' % arg for arg in args] should be args = ["%s" % arg for arg in args]!

Change History

follow-up: ↓ 2   Changed 5 years ago by ianb

  • status changed from new to closed
  • resolution set to fixed

I switched to subprocess, so the quoting was no longer necessary. Though I believe the first argument still needs to be quoted like this. I applied this change in r6318, though I haven't tested on Windows.

in reply to: ↑ 1   Changed 5 years ago by mikel

Replying to ianb:

I had the same problem on winxp using pastescript-1.3.2-py2.5.egg, ie

C:\home\code\helloworld>paster serve --reload development.ini Starting subprocess with file monitor Traceback (most recent call last):

File "c:\python25\scripts\paster-script.py", line 8, in <module>

load_entry_point('pastescript==1.3.2', 'console_scripts', 'paster')()

File "c:\python25\lib\site-packages\pastescript-1.3.2-py2.5.egg\paste\script\c

ommand.py", line 76, in run

invoke(command, command_name, options, args[1:])

File "c:\python25\lib\site-packages\pastescript-1.3.2-py2.5.egg\paste\script\c

ommand.py", line 115, in invoke

exit_code = runner.run(args)

File "c:\python25\lib\site-packages\pastescript-1.3.2-py2.5.egg\paste\script\c

ommand.py", line 210, in run

result = self.command()

File "c:\python25\lib\site-packages\pastescript-1.3.2-py2.5.egg\paste\script\s

erve.py", line 154, in command

return self.restart_with_reloader()

File "c:\python25\lib\site-packages\pastescript-1.3.2-py2.5.egg\paste\script\s

erve.py", line 340, in restart_with_reloader

self.restart_with_monitor(reloader=True)

File "c:\python25\lib\site-packages\pastescript-1.3.2-py2.5.egg\paste\script\s

erve.py", line 359, in restart_with_monitor

proc = subprocess.Popen(args, env=new_environ)

File "C:\Python25\lib\subprocess.py", line 593, in init

errread, errwrite)

File "C:\Python25\lib\subprocess.py", line 793, in _execute_child

startupinfo)

WindowsError?: [Error 22] The filename, directory name, or volume label syntax is

incorrect

Changing line 351 of serve.py from

args[0] = '"%s"' % args[0]

to

args[0] = '%s' % args[0]

and rerunning paster made the problem go away.

Note: See TracTickets for help on using tickets.