Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Trying to use pyvirtualdisplay for Python to start some applications with a virtual Xvfb X terminal. However, we've seen port clashes and would like to disable Xvfb from using TCP ports. I have read this question about doing something very similar to this, but I do not understand where this configuration should be set for it in order to work with pyvirtualdisplay (or as the default configuration otherwise).

Any help with this will be very appreciated. Thanks very much!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

PyVirtualDisplay invokes the Xvfb program, but unfortunately it does not provide a way to configure sending parameters to that program. If you want to pass the -nolisten tcp option to Xvfb with PyVirtualDisplay, you will have to edit the pyvirtualdisplay/xvfb.py file in the package.

At the bottom of the file is this section which defines the command and options:

@property
def _cmd(self):
    cmd = [PROGRAM,
           dict(black='-br', white='-wr')[self.bgcolor],
           '-screen',
           str(self.screen),
           'x'.join(map(str, list(self.size) + [self.color_depth])),
           self.new_display_var,
           ]
    return cmd

You'll need to modify it to be something like this:

@property
def _cmd(self):
    cmd = [PROGRAM,
           dict(black='-br', white='-wr')[self.bgcolor],
           '-screen',
           str(self.screen),
           'x'.join(map(str, list(self.size) + [self.color_depth])),
           self.new_display_var,
           '-nolisten',
           'tcp',
           ]
    return cmd
share|improve this answer
    
Wow. I can't tell you what a lifesaver you are! Thanks a lot. I'll add notes here if and when I can get back to this. Thanks! –  Juan Carlos Coto May 16 '13 at 19:22
1  
Yep, this absolutely works. No more TCP ports being used by Xvfb thanks! –  Juan Carlos Coto May 20 '13 at 19:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.