LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2015, 12:50 PM   #1
sharky
Member
 
Registered: Oct 2002
Posts: 569

Rep: Reputation: 84
pyqt4 adding line feeds to standard output.


Have a bash script that outputs <string> <string>: <string>. The last string always looks like an integer.

example
Code:
abc def: 42
ghi jkl: 21
mno pqr: 13
If I execute this with qprocess in a python script the result is;

Code:
abc def:
42

ghi jkl:
21

mno pqr:
13
I have no idea why a linefeed is added after the colon and at the end of each line. I am open to any advice, comments, or suggestions.

This is my python code;

Code:
	def updateSummaries(self):
		command = '/path/to/my/script'
		self.runner = QtCore.QProcess(self)
		self.runner.readyReadStandardOutput.connect(self.readSummaries)
		self.runner.start(command)

	def readSummaries(self):
		StdOut = str(self.runner.readAllStandardOutput())
		print StdOut
running python 2.7.9 and qt 4.8.6

Cheers,
 
Old 06-06-2015, 06:06 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,864
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Maybe you should run your script directly, without python/qt/whatnot.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Lost my line feeds sharky Programming 11 07-11-2011 09:34 AM
Standard script output to screen & -x option output to file BoBeau236 Programming 6 05-10-2011 07:43 AM
How do I parse the output of a command that output to standard out? gauol Programming 9 01-17-2008 01:54 PM
How to print a given line from a file on the standard output Fond_of_Opensource Linux - Newbie 1 08-24-2006 02:45 AM
how to enumerate first line of text file to standard output? zero79 Linux - General 1 07-07-2004 06:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration