spilt question

2013-05-16 Thread loial
I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help appreciated -- http://mail.python.org/m

How to raise a socket "104 connection reset by peer error"

2013-05-21 Thread loial
For testing purposes I want my code to raise a socket "connection reset by peer" error, so that I can test how I handle it, but I am not sure how to raise the error. Any advice appreciated -- http://mail.python.org/mailman/listinfo/python-list

Diagnosing socket "Connection reset by peer"

2013-05-22 Thread loial
I have a sockets client that is connecting to a printer and occassionally getting the error "104 Connection reset by peer" I have not been able to diagnose what is causing this. Is there any additional traceing I can do(either within my python code or on the network) to establish what is causin

How to clean up socket connection to printer

2013-07-09 Thread loial
I have a socket application that is connecting to a HP printer via port 9100. Occassionally I get a "Connection reset by peer" error which I am trapping and exiting the script with an error message. That works Ok, the issue I have is that the next time I run the script I get "Connection refused"

Re: How to clean up socket connection to printer

2013-07-11 Thread loial
Replies to questions : 1. Does the printer accept connections again after some time? Yes, bit seems to vary how long that takes 2. Does the printer accept connections if you close and re-open the Python interpreter? Not after a Connection reset error. The script exits after trapping the "Con

Re: How to clean up socket connection to printer

2013-07-15 Thread loial
Well, I certainly suspect the customers network connection to the printer which is over a WAN across half of Europe, but proving that is the problem is another matter. I can replicate a "Connection reset by peer" error on own printer by pulling the network cable out of the printer. And again I

pycups

2012-08-09 Thread loial
I am looking to monitor print jobs on linux via python. pycups looks a possibility, but I cannot find any useful tutorial, examples of how to use it. Can anyone help? -- http://mail.python.org/mailman/listinfo/python-list

Threads and sockets

2012-08-10 Thread loial
I am writing an application to send data to a printer port(9100) and then recieve PJL responses back on that port. Because of the way PJL works I have to do both in the same process(script). At the moment I do not start to read responses until the data has been sent to the printer. However it s

sockets,threads and interupts

2012-09-04 Thread loial
I have threaded python script that uses sockets to monitor network ports. I want to ensure that the socket is closed cleanly in all circumstances. This includes if the script is killed or interupted in some other way. As I understand it signal only works in the main thread, so how can I trap in

string contains and special characters

2012-10-09 Thread loial
I am trying to match a string that containing the "<" and ">" characters, using the string contains function, but it never seems to find the lines containing the string e.g if mystring.contains("") : Do I need to escape the characters...and if so how? -- http://mail.python.org/mailman/listinf

Re: string contains and special characters

2012-10-09 Thread loial
On Tuesday, 9 October 2012 15:19:33 UTC+1, Agon Hajdari wrote: > On 10/09/2012 04:02 PM, loial wrote: > I am trying to match a string that > containing the "<" and ">" characters, using the string contains function, > but it never seems to find the

Find lowest level directory

2012-12-13 Thread loial
How can I find the full path of the lowest level directory in a directory structure? If there is more than one directory at the lowest level, the first one found will be enough. Any help appreciated -- http://mail.python.org/mailman/listinfo/python-list

Reading file issue

2013-01-28 Thread loial
I am parseing a file to extract data, but am seeing the file being updated even though I never explicitly write to the file. It is possible that another process is doing this at some later time, but I just want to check that opening the file as follows and ignoring a record would not result in t

Re: Reading file issue

2013-01-28 Thread loial
Thanks for confirming my sanity On Monday, 28 January 2013 11:57:43 UTC, Chris Angelico wrote: > On Mon, Jan 28, 2013 at 10:47 PM, loial wrote: > I am > parseing a file to extract data, but am seeing the file being updated even > though I never explicitly write to the file. It

newbie socket help

2012-02-02 Thread loial
I am trying to write a python script to read data from a printer port using python sockets, but it seems I am locking up the port. Is there a way to ensure that I do not block the port to other applications? My knowledge of python sockets is minimal, so any help would be appreciated. -- http://m

Re: newbie socket help

2012-02-06 Thread loial
OS is Red hat enterprise linux 5.5 and python version is 2.6 On Feb 2, 4:34 pm, Dennis Lee Bieber wrote: > On Thu, 2 Feb 2012 05:53:22 -0800 (PST), loial > wrote: > > >I am trying to write a python script to read data from a printer port > >using python sockets, but it

Re: Passing array from java to python

2011-06-02 Thread loial
Unfortunately using jpython or json are not options at the moment -- http://mail.python.org/mailman/listinfo/python-list

Hardlink sub-directories and files

2011-08-02 Thread loial
I am trying to hardlink all files in a directory structure using os.link. This works fine for files, but the directory also contains sub- directories (which themselves contain files and sub-directories). However I do not think it is possible to hard link directories ? So presumably I would need t

Spurious character in IOError exception

2011-04-28 Thread loial
When I correctly trap an IOError a spurious u' appears in the file path in the exception message : The path used in the code is correct i.e. /home/myfile But the error message says : [Errno 2] No such file or directory: u'/home/myfile' I am simply doing except IOError, e: print s

Python 2.6 and timezones

2011-05-23 Thread loial
Does python have an equivalent of the java Timezone object? I need to be able to get offsets for timezones (only U.S. time zones at the moment) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 and timezones

2011-05-23 Thread loial
("EST"); long remoteOffset = tz2.getOffset(date.getTime()); Any help appreciated On May 23, 11:48 am, Daniel Kluev wrote: > On Mon, May 23, 2011 at 9:32 PM, loial wrote: > > Does python have an equivalent of the java Timezone object? > > > I need to be able

Passing array from java to python

2011-06-02 Thread loial
I need to pass some sort of array or hashmap from Java and read the data in a python script (which will be called by the java class). Is there any neater way to do this other than just passing strings? -- http://mail.python.org/mailman/listinfo/python-list

Permissions issues with zipfile

2017-09-04 Thread loial
I am getting a permission issue with the following code targetdirectory = '/data/upload' self.ZIPFileName = targetDirectory + os.sep + "MY.ZIP" zf = zipfile.ZipFile(self.ZIPFileName, mode='w') [Errno 13] Permission denied: '/data/upload/MY.ZIP' The t

permission issue with zipfile

2017-09-04 Thread loial
I am getting a permission issue with the following code targetDirectory = '/data/upload' self.ZIPFileName = targetDirectory + os.sep + "MY.ZIP" zf = zipfile.ZipFile(self.ZIPFileName, mode='w') [Errno 13] Permission denied: '/data/upload/MY.ZIP' The

Running lpr on windows from python

2016-04-20 Thread loial
I am trying to run lpr from python 2.7.10 on windows However I always get the error 'C:/windows/system32/lpr.exe ' is not recognized as an internal or external command, operable program or batch file. Even though typing the same at the command prompt works OK Any ideas? I am using subprocess

Re: Running lpr on windows from python

2016-04-20 Thread loial
As I said, the lpr command works fine from the command prompt but not from python. Everything is 64-bit (windows server 2012). -- https://mail.python.org/mailman/listinfo/python-list

Re: Running lpr on windows from python

2016-04-20 Thread loial
I get the same issue if I just specify "lpr" rather than a full path, i.e. it works from the command prompt(with forward slashes), but not from python -- https://mail.python.org/mailman/listinfo/python-list

Re: Running lpr on windows from python

2016-04-22 Thread loial
Nothing seems to work. Even doing import os os.system("lpr") still returns 'lpr' is not recognized as an internal or external command,operable program or batch file. Even though I can run lpr fine from the command prompt -- https://mail.python.org/mailman/listinfo/python-list

Can't run lpr from python on windows 2012 server

2016-04-22 Thread loial
I am reposting this question in a simpler form. I can run lpr from the command prompt but not from python os.system("notepad") works os.system("lpr") does not work. Basically it says lpr is not a known program or executable Why can I run lpr from the windows command prompt but not from python(2

Re: Running lpr on windows from python

2016-04-22 Thread loial
I finally found the solution here : http://www.tomshardware.co.uk/forum/240019-44-error-windows Copied lpr.exe, lprhelp.dll, and lprmonui.dll from the System32 folder to the sysWOW64 folder Thanks for all your efforts -- https://mail.python.org/mailman/listinfo/python-list

Re: Can't run lpr from python on windows 2012 server

2016-04-22 Thread loial
016, at 10:15, loial wrote: > > I am reposting this question in a simpler form. > > > > I can run lpr from the command prompt but not from python > > > > os.system("notepad") works > > os.system("lpr") does not work. Basically it says lpr is n

smtplib not working when python run under windows service via Local System account

2016-05-05 Thread loial
I have a python 2.7.10 script which is being run under a windows service on windows 2012 server . The python script uses smtplib to send an email. It works fine when the windows service is run as a local user, but not when the windows service is configured to run as Local System account. I get n

ZipImportError: can't find module

2016-05-24 Thread loial
I am suddenly having a problem with importing a module from a zip file in Python 2.4.1 What has been working for years suddenly has an error : zipimport.ZipImportError: can't find module 'mymodule' PYTHONPATH is correct, it points to the zip file containing mymodule N.B. the python script(unch

Add directory to sys.path based on variable

2014-01-30 Thread loial
I want to add a path to sys.path based upon a variable Can I do that? Hardcodeing the path works fine, but I want to set it based upon a variable. I know I can set PYTHONPATH, but just wondering if I can add a directory on the fly to sys.path using a variable -- https://mail.python.org/ma

Re: Add directory to sys.path based on variable

2014-01-30 Thread loial
Ok, that works fine with the apth hard coded, but I want to do something like the code below. i.e I am trying to dynamically add a path that is relative to the path of the current executing python script. In this case the import fails. import sys import os from os.path import * scriptpath=os.p

Re: Add directory to sys.path based on variable

2014-01-30 Thread loial
Idiot that I am...I was not calling the script with the full path ! Thanks for your help -- https://mail.python.org/mailman/listinfo/python-list

can't decompress data; zlib not available

2016-01-11 Thread loial
I am migrating a python script from Red hat linux REL 6.6 to AIX 7.1 I am using python 2.7.10 On AIX I the ror zipimport.ZipImportError: can't decompress data; zlib not available Any ideas how to get this to work on AIX? -- https://mail.python.org/mailman/listinfo/python-list

Web services from python

2014-10-27 Thread loial
What is the best package to use with python 2.6 to access Web services. Is it ZSI? Can anyone recommend a good tutorial, preferably with a sandbox web service? -- https://mail.python.org/mailman/listinfo/python-list

Python path on windows

2015-02-20 Thread loial
On Linux we use #!/usr/bin/env python At the start of scripts to ensure that the python executable used is the one defined in the PATH variable, rather than hardcoding a path to the python executable. What is the equivalent functionality in Windows? -- https://mail.python.org/mailman/listinf

Re: Python path on windows

2015-02-20 Thread loial
On Friday, February 20, 2015 at 2:54:26 PM UTC, Ian wrote: > On Feb 20, 2015 7:46 AM, "loial" wrote: > > > > > > On Linux we use > > > #!/usr/bin/env python > > > > > > At the start of scripts to ensure that the python executable used

Concatenate list values

2015-02-23 Thread loial
Is there a quick way to concatenate all the values in a list into a string, except the first value? I want this to work with variable length lists. All values in list will be strings. Any help appreciated -- https://mail.python.org/mailman/listinfo/python-list

Re: Concatenate list values

2015-02-24 Thread loial
Many thanks for those you chose to help me out. Problem solved. -- https://mail.python.org/mailman/listinfo/python-list

find and replace string in binary file

2014-03-04 Thread loial
How do I read a binary file, find/identify a character string and replace it with another character string and write out to another file? Its the finding of the string in a binary file that I am not clear on. Any help appreciated -- https://mail.python.org/mailman/listinfo/python-list

Re: find and replace string in binary file

2014-03-05 Thread loial
Thanks Emile. Unfortunately I have to use python 2.6 for this On Wednesday, 5 March 2014 00:13:00 UTC, emile wrote: > On 03/04/2014 02:44 PM, Chris Angelico wrote: > > > On Wed, Mar 5, 2014 at 12:18 AM, Peter Otten <__pete...@web.de> wrote: > > >> loial wrote:

Using netrc when user password is blank

2013-09-05 Thread loial
I am having issues using the netrc package for users where the password is blank. It works fine for users with password is not blank and is spacified in the .netrc I am not sure if this is an issue with the .netrc file or my use of the .netrc package. .netrc file looks like : machine myserve

U.K. Royal Mail MailMark web service from python?

2015-04-13 Thread loial
Anyone out there got any examples of calling the UK Royal Mail Mailmark web service from python? -- https://mail.python.org/mailman/listinfo/python-list

passing double quotes in subprocess

2015-09-08 Thread loial
I need to execute an external shell script via subprocess on Linux. One of the parameters needs to be passed inside double quotes But the double quotes do not appear to be passed to the script I am using : myscript = '/home/john/myscript' commandline = myscript + ' ' + '\"Hello\"' process = s

Re: passing double quotes in subprocess

2015-09-08 Thread loial
Yep, that did the trick...cheers On Tuesday, September 8, 2015 at 12:04:05 PM UTC+1, loial wrote: > I need to execute an external shell script via subprocess on Linux. > > One of the parameters needs to be passed inside double quotes > > But the double quotes do not appear to b

Modify environment variable for subprocess

2015-09-23 Thread loial
I need to modify the LIBPATH environment variable when running a process via subprocess, but otherwise retain the existing environment. Whats the best way to do that? -- https://mail.python.org/mailman/listinfo/python-list

capturing SNMP trap events

2014-07-04 Thread loial
I want to monitor printers for events such as the completion of printing. If the printer initiates an SNMP trap event when the job has finished printing, how can I capture this? Presumably I need some sort of deamon to listen for these trap messages. I have looked at pySNMP but am not sure if t

reading file in for loop

2014-09-05 Thread loial
If I read a file using a for loop, as follows, is the file left open if I execute a break in the for loop? for line in open(myFile).readlines(): if something: break -- https://mail.python.org/mailman/listinfo/python-list

subprocess question re waiting

2013-04-08 Thread loial
I want to call a child process to run a shell script and wait for that script to finish. Will the code below wait for the script to finish? If not then how do I make it wait? Any help appreciated. import subprocess command = "/home/john/myscript" process = subprocess.Popen(command, stdin=su

install paramiko on AIX (ActiveState)

2007-06-21 Thread loial
I need help installing paramiko on ActiveState python on AIX 5 I am new to python so need info on how to download and install paramiko AIX box does not have internet connection so presume cannot use ez_setup.py? Can anyone help? -- http://mail.python.org/mailman/listinfo/python-list

How to check if file is in use?

2007-07-10 Thread loial
Is there anyway in pythn to check whether a file is being used/written to by another process, e.g like the fuser command? -- http://mail.python.org/mailman/listinfo/python-list

variable naming query

2007-07-12 Thread loial
I'ma a newbie python user and would like clarification on variable naming conventions. What is the difference between self.myvariable self._myvariable self.__myvariable and when should I use each of them? -- http://mail.python.org/mailman/listinfo/python-list

Problems with os.rename

2007-04-20 Thread loial
I am having problems with os.rename on AIX The source file definately exists and the target file does not. However the rename always generates an OSerror exception. I can do the rename via a mv statement at the AIX command line with no problem. How can I get more info what the cause of the OSE

Store variable name in another variable

2007-04-26 Thread loial
I need to store a list of variable names in a dictionary or list. I then later need to retrieve the names of the variables and get the values from the named variables. The named variables will already have been created and given a value. I hope thats clear!!! How can I do this? -- http://mail.p

Problems with time

2007-05-01 Thread loial
I am running on an AIX system with time zone set to BST If I run the following, I get the GMT time, i.e an hour less than the correct time. How can I get the correct time now = time() timeProcessed = strftime("%H:%M",gmtime(now)) -- http://mail.python.org/mailman/listinfo/pyth

Re: Store variable name in another variable

2007-05-01 Thread loial
Pointal <[EMAIL PROTECTED]> wrote: > Cameron Laird wrote: > > In article <[EMAIL PROTECTED]>, > > Laurent Pointal <[EMAIL PROTECTED]> wrote: > >>loial a ?it : > >>> I need to store a list ofvariablenames in a dictionary or list. I > >>&

Need help with python and pyxml on AIX

2007-03-31 Thread loial
I have been asked to install a python application on AIX 5.3 that runs OK on Windows I have installed Python 4.2.2 from python.org and pyXML form sourceforge. However when I run the application I get the following error : class xml.sax._exceptions.SAXReaderNotAvailable Do I need to set some Pyth

Newbie help with array handling

2007-04-12 Thread loial
I am new to python and am converting an awk script to python I need to store some data in an array/table of some form keyvalue1, value1, value2, value3 keyvalue2, value1,value2, value3 keyvalue3, value1,value2,value3 etc I will later need to sort in keyvalue order and also need to be able to che

Re: Newbie help with array handling

2007-04-12 Thread loial
OK, thanks for the replies One other thing...I need to update the values since they are basically totals that I am accumulating. How do I update a specific value for a specific key? -- http://mail.python.org/mailman/listinfo/python-list

More newbie help required with dictionaries

2007-04-16 Thread loial
The following code only returns the last row(22) added to the machines dictionary. presumably I need some additional syntax to add rows to the dictionary rather than overwrite. What do I need to add? machinekey = "11" machines = { machinekey:[1,0,0,0,0,0,0,0,0,0,0,0,0] } machinekey = "2

Re: More newbie help required with dictionaries

2007-04-16 Thread loial
machines[machinekey] = [0,1,0,0,0,0,0,0,0,0,0,0,0] is what I needed...thanks On 16 Apr, 15:07, Christoph Haas <[EMAIL PROTECTED]> wrote: > On Mon, Apr 16, 2007 at 06:43:37AM -0700, loial wrote: > > The following code only returns the last row(22) added to the > >

Handling sorted dictionaries

2007-04-17 Thread loial
The following code gives the error d=sortedmachines[machine] TypeError: list indices must be integers What works for the unsorted dictionary does not work for the sorted dictionary. Can anyone help? machinekey = "11" machines = {} machines[machinekey]=[1,0,0,0,0,0,0,0,0,0,0,0,0] machinek

Python thinks file is empty

2007-11-05 Thread loial
I am writing a file in python with writelines f = open('/home/john/myfile',"w") f.writelines("line1\n") f.writelines("line2\n") f.close() But whenever I try to do anything with the file in python it finds no data. I am trying ftp, copying the file...the resultant file is always 0 bytes, although

PYTHONPATH and PYTHON_PATH

2007-12-04 Thread loial
Is there any difference? Does it matter which I use? -- http://mail.python.org/mailman/listinfo/python-list

ftplib.nlst gives error on empty directory

2007-12-07 Thread loial
Trying to use ftplib.FTP.nlst() method to list the files in a directory on a FTP server. It works fine except when there are no files in the directory. Then it gives the error ftplib.error_perm: 550 No files found. How can I handle this cleanly? -- http://mail.python.org/mailman/listinfo/py

Delete hidden files on unix

2008-03-03 Thread loial
How can I delete hidden files on unix with python, i.e I want to do equivalent of rm .lock* -- http://mail.python.org/mailman/listinfo/python-list

Web services

2009-01-26 Thread loial
I am trying to learn about web services and how to interface with a 3rd party web service from python. Can anyone point me at an idiots guide/tutorial for someone who is new to web services? -- http://mail.python.org/mailman/listinfo/python-list

Python ssh with SSH Tectia server

2009-02-03 Thread loial
Has anyone any experiencing with ssh between a python client and the SSH Tectia server from SSH (ssh.com) ? Does it work? -- http://mail.python.org/mailman/listinfo/python-list

python ssh and Tetia SSH server

2009-02-10 Thread loial
Anyone out there any experience of using python ssh modules to connect to the Tetia SSH server from SSH (ssh.com)? -- http://mail.python.org/mailman/listinfo/python-list

Using paramiko rsa key

2009-02-10 Thread loial
I want to connect via ssh from a python script on windows to an AIX server running openSSH using rsa keys rather than a password. Can anyone provide me with /point me at a simple tutuorial on the steps I need to go though in terms of geneerating the key, installing on the server and connecting in

Re: Using paramiko rsa key

2009-02-10 Thread loial
Can anyone be a little more helpful than Tino? I have generated the key file as follows on windows and ftp'd the id_rsa.pub file to the .ssh directory on the server and renamed to authorized_keys import paramiko key = paramiko.RSAKey.generate(2048) key.write_private_key_file('Z:/id_rsa') file

Re: Using paramiko rsa key

2009-02-10 Thread loial
On 10 Feb, 17:08, "Martin P. Hellwig" wrote: > loial wrote: > > Can anyone be a little more helpful than Tino? > > > I'll do some freebie hints :-) > What I would do is try first whether key authentication works at all, > for example following a tutori

replace ftp by local copy

2009-02-16 Thread loial
I have been given an old python application that calls ftplib in many places to copy files to a remote server. I have been given the task of cloneing this code so that ftp is not used, but files are just copied locally in a scenerio where ftp is not available. The code is not well structured which

Get file name from file handle

2009-02-17 Thread loial
Is there anyway, having been passed a file handle, to get the filename? I am assuming not, but thought I would ask -- http://mail.python.org/mailman/listinfo/python-list

sftp with no password from python

2009-01-08 Thread loial
Is it possible to use sftp without a password from python? -- http://mail.python.org/mailman/listinfo/python-list

Re: sftp with no password from python

2009-01-09 Thread loial
On 8 Jan, 18:49, Mike Hjorleifsson wrote: > On Jan 8, 10:39 am, loial wrote: > > > Is it possible to usesftpwithout a password from python? > > Yes you can use keys you preestablish between the server and client so > you dont need passwords, i do this on all my serv

Using optparse

2009-04-23 Thread loial
A shell script is passing parameters to my python script in the following format -PARAM1 12345 -PARAM2 67890 Can I parse these with optparse ? If so how? I can't seem to get it to work. It seems to expect --PARAM1 and -- PARAM2 -- http://mail.python.org/mailman/listinfo/python-list

Compare 2 files and discard common lines

2008-05-29 Thread loial
I have a requirement to compare 2 text files and write to a 3rd file only those lines that appear in the 2nd file but not in the 1st file. Rather than re-invent the wheel I am wondering if anyone has written anything already? -- http://mail.python.org/mailman/listinfo/python-list

Question re ConfigParser

2008-08-20 Thread loial
Given a section like [Data] value1 value2 value3 Can ConfigParser be easily used to put the values in a dictionary? If so, how? -- http://mail.python.org/mailman/listinfo/python-list

Re: Question re ConfigParser

2008-08-21 Thread loial
On 20 Aug, 13:49, alex23 <[EMAIL PROTECTED]> wrote: > On Aug 20, 5:34 pm, loial <[EMAIL PROTECTED]> wrote: > > > Given a section like > > > [Data] > > value1 > > value2 > > value3 > > > Can ConfigParser be easily used to put the valu

ssh keepalive

2008-10-01 Thread loial
I have a problem with a ssh connection in python I get the error 'NoneType' object has no attribute 'exec_command' I am thinking that maybe the ssh connection is timeing out. Since I have no control over the configuration of the ssh server(which is AIX 5.23), is there anything I can do in pytho

Re: ssh keepalive

2008-10-02 Thread loial
<> def command ( self , command ) : """ process requested command through ssh """ print command if not self._connected : return False , "No SSH connection available" try : stdin , stdout , stderr = self._ssh.exec_command( command )

Python, equivalent of set command

2006-03-27 Thread loial
In unix shell script I can do the following to get the status and values returned by a unix command OUTPUT=`some unix command` STATUS=$? if [ $STATUS -ne 0 ] then exit 1 else set $OUTPUT VAL1=$1 VAL2=$2 VAL3=$3 fi How can I achieve the same in python? I know how to run it via the os.sy

Oracle jdbc sql select for update in python

2010-11-17 Thread loial
I want to do a select from...for update in python, update the selected row and then commit; However cannot seem to get it to work...the update statement seems to be waiting because the row is locked. Presumably oracle thinks the update is another transaction. How can I get this to work? What stat

PJL

2011-01-10 Thread loial
Anyone got any experience of send PJL commands to a printer using Python on Unix? -- http://mail.python.org/mailman/listinfo/python-list

Re: PJL

2011-01-10 Thread loial
Thanks for responding.. First question...how do I send it to the printer? Printer would be on the network. -- http://mail.python.org/mailman/listinfo/python-list

Re: PJL

2011-01-11 Thread loial
Thank you. I was able to send the following PJL to the printer and it worked. @PJL STMSG DISPLAY = "Hello from John" Do you have any experience handling PJL responses from the printer?...What I really want to do is get PJL information back from the printer and read it in python(or some other Unix

How to print via python on windows

2010-06-14 Thread loial
What is the easiest way to send a text file to a networked printer from a python script running on windows? -- http://mail.python.org/mailman/listinfo/python-list

Kick off a delete command from python and not wait

2010-07-20 Thread loial
I have a requirement to kick off a shell script from a python script without waiting for it to complete. I am not bothered about any return code from the script. What is the easiest way to do this. I have looked at popen but cannot see how to do it. -- http://mail.python.org/mailman/listinfo/p

Get name of file from directory into variable

2010-08-03 Thread loial
In a unix shell script I can do something like this to look in a directory and get the name of a file or files into a variable : MYFILE=`ls /home/mydir/JOHN*.xml` Can I do this in one line in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Get name of file from directory into variable

2010-08-03 Thread loial
On 3 Aug, 11:31, Alex Willmer wrote: > On Aug 3, 11:21 am, loial wrote: > > > In a unix shell script I can do something like this to look in a > > directory and get the name of a file or files into a variable : > > > MYFILE=`ls /home/mydir/JOHN*.xml` > > >

lpr via subprocess in 2.4

2010-08-04 Thread loial
I am am trying to run the following command via subprocess lpr -P printqueue filetoprint I cannot seem to get it to work and return stderr I think the issue is how to specify the arguments I am trying subprocess.Popen(['lpr -P' ,'laserlpr','/etc/hosts'], shell=False) but get error : Tracebac

Re: lpr via subprocess in 2.4

2010-08-04 Thread loial
ess.PIPE, stderr=subprocess.PIPE) print process.communicate() On 4 Aug, 12:08, Peter Otten <__pete...@web.de> wrote: > loial wrote: > > I am am trying to run the following command via subprocess > > > lpr -P printqueue filetoprint > > > I cannot seem to get i

How to read large amounts of output via popen

2010-08-06 Thread loial
I need to read a large amount of data that is being returned in standard output by a shell script I am calling. (I think the script should really be writing to a file but I have no control over that) Currently I have the following code. It seeems to work, however I suspect this may not work with

Re: How to read large amounts of output via popen

2010-08-06 Thread loial
Ok, thats great. Thanks for the very elegant solution(s) On 6 Aug, 13:44, Nobody wrote: > On Fri, 06 Aug 2010 02:06:29 -0700, loial wrote: > > I need to read a large amount of data that is being returned in > > standard output by a shell script I am calling. > > > (I

Parse xml file

2009-08-27 Thread loial
Is there a quick way to retrieve data from an xml file in python 2.4, rather than read the whole file? -- http://mail.python.org/mailman/listinfo/python-list

Scheduling in python

2010-09-23 Thread loial
I want to enable my end users to be able to schedule a task(actually running another python or shell script). Rather than scheduling it directly in cron, are there any python modules I could use? -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >