Printing Popen Output Using Windows 7


 
Thread Tools Search this Thread
Top Forums Programming Printing Popen Output Using Windows 7
Prev   Next
# 1  
Old 11-04-2015
Printing Popen Output Using Windows 7

Hi Guys,

I am new to python and I am trying to print ouput of Popen on my text screen (tkinter gui).

I was able to make it work on Linux with this code:

Linux: Working

Code:
def PrintSomething2():
	outputdata = commands.getstatusoutput("sudo fping -f host.list")
	for i in outputdata:
		print i
	sp.call(["rm", "host.list"])

However, I am trying to do the same for a windows machine but it is not working:

Windows: NOT Working

Code:
import subprocess as sp
from subprocess import Popen
import sys
import commands

def PrintSomething2():
	outputdata = Popen("scanping.bat")
	for i in outputdata:
		print i
	deletefile = Popen("DEL", "sites.txt")

Note: It is printing in my terminal though:

Image

Let me know if you have any tips. Thanks in advanced!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Linux to Windows Printing: PDF starts printing from middle of page.

We are using Red Hat. We have a issue like this: We want to print from Linux, to a printer attached to a Windows machine. What we want to print is a PDF. It prints, but the printing starts from the middle of the page. In the report, there is no space at the top but still printing starts from the... (5 Replies)
Discussion started by: rohan69
5 Replies

2. SCO

Printing to Windows 7 using Samba 2.0.3 via VPN connection to SCO 3.2v5.0.6

I would like to know if anyone has a way to PRINT TO a printer attached to a Windows 7 PC, from SCO, while logged in via a VPN connection. I am able to attach to a Samba share on the SCO server for files while attached to the VPN, so I know my Samba is workling - but my print jobs return: ... (2 Replies)
Discussion started by: tbb999
2 Replies

3. AIX

Printing from AIX 5.0 to windows

Dear All, I just want to know how we can print a report from unix server to that printer which has installed on windows. As from UNIX i can use below command to print ,but what set-up i need to do . lpr -P<printer name> <report Name> Pls suggest me. Thanks Arpit (2 Replies)
Discussion started by: Arpitmitm
2 Replies

4. Programming

popen catching output and errors

I have code which at the moment only catches the command/program output if the program runs correctly, which is a small problem as I would like to capture everything from stdout inclusive of errors FILE *fp; fp = popen(command.c_str(), "r"); while(fgets(cbuf, 1024, fp) != NULL){ .....do stuff... (1 Reply)
Discussion started by: mshindo
1 Replies

5. UNIX for Advanced & Expert Users

Printing to Windows and maintaining control

I'm new at the entire spectrum of printing in Unix, and especially when--as I understand it--the printers are on a Windows server. At work we have a variety of printers and printing from Windows, or from Unix via lp or lpr works fine. The initial problem: Our users will be printing up to 20... (1 Reply)
Discussion started by: effigy
1 Replies

6. HP-UX

Printing from unix to windows.

Hi, This issue is killing me. I'm looking to get advise on setting up a remote printer in unix "HP-UX" which will print to a printer which sits remotely connected to a windows 2000 server. I guess I'm looking for an idiots guide - any assistance you may offer will be gratefully received. ... (2 Replies)
Discussion started by: pmaths
2 Replies

7. Shell Programming and Scripting

printing output more than 13

i want to print the idle time of the users more than 10 days. for eg: my "w" command output is like below. -sh-3.00$ w 03:47:41 up 13 days, 16:59, 3 users, load average: 10.00, 10.00, 10.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root :0 - ... (2 Replies)
Discussion started by: Krrishv
2 Replies

8. Solaris

Error message printing to Windows on port 515

Hello, We have an application which runs on Windows 2000 that responds to prrint requests by anyone using RFC1179 protocol on port 515. We are getting an error message when submitting print requests from Sun Solaris 9. "Windows 2000 LPD Server Error: Specified printer does not exist"... (0 Replies)
Discussion started by: pauls
0 Replies

9. UNIX for Advanced & Expert Users

Unix to Windows 2000 printing over the internet

I need help printing to the Windows 2000 Pro environement from a Unix box, that the Windows 2000 system dials into via a ISP. We are still waiting for our T1 line to be installed but will need to know if that process will change when that is installed. I know that you can print from Windows 2000... (1 Reply)
Discussion started by: supportit
1 Replies
Login or Register to Ask a Question
hp-print(1)							   User Manuals 						       hp-print(1)

NAME
hp-print - Print Utility DESCRIPTION
A simple print UI front-end to lp/lpr. SYNOPSIS
hp-print [DEVICE_URI|PRINTER_NAME] [MODE] [OPTIONS] [FILES] PRINTER
|DEVICE-URI To specify a device-URI: -d<device-uri> or --device=<device-uri> To specify a CUPS printer: -p<printer> or --printer=<printer> MODE
Run in graphical UI mode: -u or --gui (Default) OPTIONS
Use Qt4: --qt4 (Default) Set the logging level: -l<level> or --logging=<level> <level>: none, info*, error, warn, debug (*default) Run in debug mode: -g (same as option: -ldebug) This help information: -h or --help SEE ALSO
hp-printsettings AUTHOR
HPLIP (Hewlett-Packard Linux Imaging and Printing) is an HP developed solution for printing, scanning, and faxing with HP inkjet and laser based printers in Linux. REPORTING BUGS
The HPLIP Launchpad.net site https://launchpad.net/hplip is available to get help, report bugs, make suggestions, discuss the HPLIP project or otherwise contact the HPLIP Team. COPYRIGHT
Copyright (c) 2001-14 Hewlett-Packard Development Company, L.P. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to distribute it under certain conditions. See COPYING file for more details. Linux 4.0 hp-print(1)