It is pretty easy actually to check if there was any error, it gives you back the return code: For example: $ ./pk2cmd I -PPIC16f887 || echo "ERROR $?" When PicKit2 os not connected it return with code: 10 You can ask the return codes by invoking the command: $ ./pk2cmd /?E Just quickly put a test Perl script together, which defines all return codes documented by that /?E argument. That displays this when PicKit2 is not connected: $ ./pk2cmd.pl No PICkit 2 found. pk2cmd Returned With: 10 -> NO_PROGRAMMER -> -The PK2CMD executable is unable to find a connected PICkit 2 programmer. The script: #!/usr/bin/perl my %pk2cmdReturnCodes =3D ( 0 =3D> { name =3D> 'OPSUCCESS', description =3D> "-Returned if all selected operations complete successfully." }, 5 =3D> { name =3D> 'VOLTAGE_ERROR', description =3D> "-A Vdd and/or Vpp voltage error was detected. Th= is could be due to PICkit 2 being improperly connected to a part, incorrect part selection, or interference from other circuitry on the target board." }, 7 =3D> { name =3D> 'OPFAILURE', description =3D> "-Returned if an operation fails and a more specif= ic error does not exist." }, 10 =3D> { name =3D> 'NO_PROGRAMMER', description =3D> "-The PK2CMD executable is unable to find a connected PICkit 2 programmer." }, 11 =3D> { name =3D> 'WRONG_OS', description =3D> "-Returned if the OS firmware must be updated befo= re being used with this version of PK2CMD." }, 15 =3D> { name =3D> 'FILE_OPEN_ERROR', description =3D> "-Returned if a file specified for reading to (-gf...) cannot be opened for writing." }, 24 =3D> { name =3D> 'DEVICEFILE_ERROR', description =3D> "-The PK2CMD executable cannot find the device fil= e PK2DeviceFile.dat or the device file may be corrupted." }, 28 =3D> { name =3D> 'UPDGRADE_ERROR', description =3D> "-Returned when an OS firmware upgade (-d...) fail= s." }, 34 =3D> { name =3D> 'PGMVFY_ERROR', description =3D> "-Returned if a program or verify operation fails.= " }, 36 =3D> { name =3D> 'INVALID_CMDLINE_ARG', description =3D> "-A syntax error in a command line argument was detected, an invalid combination of operations was entered, an invalid value was entered, or a memory region was selected that is not supported by the current device." }, 37 =3D> { name =3D> 'INVALID_HEXFILE', description =3D> "-Error opening or loading a specified hex file (-f...)." }, 39 =3D> { name =3D> 'AUTODETECT_FAILED', description =3D> "-A part autodetect operation failed to find a kno= wn part." }, ); system("./pk2cmd -I -PPIC16f887"); if ( $? =3D=3D -1 ) { print "pk2cmd failed to execute: $!\n"; } elsif ( $? & 127 ) { printf "pk2cmd died with signal %d, %s a coredump\n", ( $? & 127 ), ( $? & 128 ) ? 'with' : 'without'; } else { my $returnCode =3D $? >> 8; my $returnShort =3D 'UNKNOWN'; my $returnText =3D 'Unknown Error Occured.'; if ( exists $pk2cmdReturnCodes{$returnCode} ) { $returnShort =3D $pk2cmdReturnCodes{$returnCode}{name}; if ( exists $pk2cmdReturnCodes{$returnCode}{description} ) { $returnText =3D $pk2cmdReturnCodes{$returnCode}{description}; } } print "pk2cmd Returned With: $returnCode -> $returnShort -> $returnText\n"; } Tamas On 22 April 2013 07:42, Neil wrote: > Yes, pickit2's are still being sold, and I have a few, which is what I > want to use. > > I know how to invoke a dos-level command from python, but expecting > that directly controlling the pickit2 would get me results easier -- > ie: programming failed or successful, errors, etc. Otherwise I'd have > to invoke the pk2cmd command, then redirect and parse the output > etc... tedious. > > Cheers, > -Neil. > > > > Quoting Tamas Rudnai : > > > Sorry to chip in but as far as I know Microchip is still selling PicKit= 2 > -- > > although newer devices might not being supported by that. > > > > You can use pk2cmd command line tool, you can call external command fro= m > > pretty much any scripting languages, python, perl, ruby, bash or window= s > > cmd. > > > > Tamas > > > > > > On 21 April 2013 20:40, Allen Mulvey wrote: > > > >> I believe the pickit2 has officially been replaced by the > >> pickit3. I purchased a clone of a pickit3 with a separate > >> board with zif sockets for around $30 US on eBay. It works > >> well with Microchip MPLAB. > >> > >> Allen > >> > >> -----Original Message----- > >> From: piclist-bounces@mit.edu > >> [mailto:piclist-bounces@mit.edu] On Behalf Of Neil > >> Sent: Sunday, April 21, 2013 7:49 PM > >> To: piclist@mit.edu > >> Subject: [PIC] Script languages with pickit2 > >> > >> I'm looking for a script language that I can control a > >> pickit2 with. > >> My first thought is to use python, and found references to > >> "pyk", but > >> can't get it from anywhere. Seems obsolote, as those > >> references are > >> several years old. > >> > >> I also found pypickit, and found this code ( > >> http://code.google.com/p/pypickit/source/browse/trunk/python > >> /pickit/PicKit2.py?spec=3Dsvn92&r=3D92 ), but not sure how to > >> use it. I can't find any documentation that explains how to > >> use it. Anyone here have any experience with > >> it? > >> > >> Linux or Windows should be fine. > >> > >> Cheers, > >> -Neil. > >> > >> > >> -- > >> http://www.piclist.com/techref/piclist PIC/SX FAQ & list > >> archive > >> View/change your membership options at > >> http://mailman.mit.edu/mailman/listinfo/piclist > >> > >> > >> -- > >> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > >> View/change your membership options at > >> http://mailman.mit.edu/mailman/listinfo/piclist > >> > > > > > > > > -- > > int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; > > printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", > > q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } > > -- > > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > > View/change your membership options at > > http://mailman.mit.edu/mailman/listinfo/piclist > > > > > > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .