Windows 10 64 Problem

Started by Oskar, July 11, 2019, 05:02:35 AM

Previous topic - Next topic

Oskar

Recently I reinstalled my OS(Windows 10, 64). Exiftool.pl used to work like a charm with no problems at all. After the refresh, I reinstalled Activestate Perl and Exiftool as I did for the last many years but it did not worked like before. Exiftool.pl would only print the help text. After many trials, I decided to rename exiftool.pl back to exiftool and run it as "perl exiftool [args etc]". To my surprise, it worked perfectly.

Do you have any idea why exiftool.pl won't work while  "perl exiftool" works?

Phil Harvey

It sounds like somehow the command-line arguments aren't getting passed properly to the app when you run as "exiftool.pl".  I don't know how the association with the ".pl" extension is made to run Perl when a ".pl" file is executed, but I would look there.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Oskar

#2
Thank you for your kind and fast reply!

Little update: I made a Perl hello file, named it hello.pl, placed it alongside exiftool.pl(in c:\Windows\) and the hello.pl file works with no problem - exiftool.pl still not working.

I am using Exiftool 11.54 from https://www.exiftool.org/Image-ExifTool-11.54.tar.gz


Here is what I wrote in hello.pl

#!C:\Perl\bin\perl.exe
use strict;
use warnings;
print "Hello World\n";



Also, 
perl c:\windows\exiftool.pl -ver prints 11.54


Phil Harvey

...but your hello.pl doesn't pass any arguments.  Try this:

#!C:\Perl\bin\perl.exe
use strict;
use warnings;
print "Hello World (@ARGV)\n";


Then do "hello arg1 arg2 ..."

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Oskar

Your code prints Hello World () if I run it as hello.pl

But, if I run it as:

perl hello.pl arg1 arg2 it prints

Hello World(arg1 arg2)

Hayo Baan

Quote from: Oskar on July 12, 2019, 06:57:45 AM
Your code prints Hello World ()

Confirming Phil's suspicion that command-line arguments aren't passed correctly when executing scripts  this way. Sounds like a severe bug in your Perl installation because this should just work.
Hayo Baan – Photography
Web: www.hayobaan.nl

Oskar

Quote from: Hayo Baan on July 12, 2019, 07:00:04 AM
Quote from: Oskar on July 12, 2019, 06:57:45 AM
Your code prints Hello World ()

Confirming Phil's suspicion that command-line arguments aren't passed correctly when executing scripts  this way. Sounds like a severe bug in your Perl installation because this should just work.


This is what I am using:

https://platform.activestate.com/unprofbun/ActivePerl-5.28/distributions

To be more precise the perl installer is called ActivePerl-5.28.1.2801-MSWin32-x64-24563874.exe

Phil Harvey

Quote from: Oskar on July 12, 2019, 06:57:45 AM
Your code prints Hello World () if I run it as hello.pl

Do you mean "hello.pl arg1 arg2" ?  If so, then there is a simple parameter passing problem.  Again, look into how the .pl association is made.  On my Windows system typing "exiftool.pl" will not run the app.  Your system needs some sort of setting to run the .pl file directly.  And I don't know how this is done.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Oskar

Quote from: Phil Harvey on July 12, 2019, 07:05:16 AM
Quote from: Oskar on July 12, 2019, 06:57:45 AM
Your code prints Hello World () if I run it as hello.pl

Do you mean "hello.pl arg1 arg2" ?  If so, then there is a simple parameter passing problem.  Again, look into how the .pl association is made.  On my Windows system typing "exiftool.pl" will not run the app.  Your system needs some sort of setting to run the .pl file directly.  And I don't know how this is done.

- Phil

Yes, hello.pl arg1 arg2 prints Hello World()
but perl hello.pl arg1 arg2 prints Hello World arg1 arg2


The associations are made by the perl installer. I can see the Perl icon on each .pl file.

Phil Harvey

Right.  But how does the installer make these associations?  Presumably it modifies some .ini file somewhere.  There may be some tweaking that needs to be done there for your system (although I have no idea why this would be the case).
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Oskar

Quote from: Phil Harvey on July 12, 2019, 07:29:01 AM
Right.  But how does the installer make these associations?  Presumably it modifies some .ini file somewhere.  There may be some tweaking that needs to be done there for your system (although I have no idea why this would be the case).

Thanks to your indications I found the bug!!!

In the registry I manually changed all the occurrences of "C:\perl\bin\perl.exe" "%1"  to "C:\perl\bin\perl.exe" "%1" %* - I did it for perl.exe, perl5.28.1.exe and wperl.exe. First I tried only for perl.exe, but it did not work, I had to manually edit each and every executable entry, that is about four or five entries.

Perhaps is  a bug in the latest ActiveState Perl installer. I found a link as old as 2007(!!!) talking about this issue: https://community.activestate.com/forum-topic/problem-passing-arguments


Now, exiftool.pl works as expected, as used to, that is like a charm - THANK YOU!

Stan Wickham

I'm glad you solved your problem. I'm new to Perl on Windows. A version of Perl comes with Mac OS, so I've never started from scratch before. Based on this thread and the ActiveState forum thread you linked, I decided to find the state of my Windows 10 64-bit system after a Strawberry Perl install.

After the tests below, I wonder - is the presence of the types of registry entries you fixed, "C:\perl\bin\perl.exe" "%1" %*, for example, necessary for Perl? To my understanding, my system does not have them. Are they an artifact of Active Perl and necessary for Active Perl?

At the command line, assoc pl returns .pl=Perl_program_file I can't remember if Strawberry Perl built the association, or if I right-clicked on the first '.pl' file I saw and set 'Open With' to the 'Perl (Command Line)' application included with Strawberry Perl.

ftype perl returns File type 'perl' not found or no open command associated with it. A search of all FileType settings saved to a file, ftype > c:\Users\Public\ftype.txt, found no occurrences of 'perl'.

Neither 'Strawberry Perl' nor 'Perl' appear in the list at 'Settings > Apps > Default Apps > Set Defaults by App'.

'Perl interpreter' appears with '.pl' ('Perl program file') in the list 'Settings > Apps > Default Apps > Choose default apps by file type'.

Phil's Hello.pl test returns Hello World (arg 1 arg2) when invoked by means of perl Hello.pl arg1 arg2 and Hello.pl arg1 arg2 with 'Hello.pl' saved to 'C:\Windows'.

obetz

Stan, Oscar: Did you install Perl to use it also for other things than ExifTool, or only to run ExifTool?

Oliver

Oskar

@Stan: I am mostly a visual artist happy to have sorted out the problem  but not a programmer. What you ask is over my knowledge. Anyway, I was able to sort it out only thanks to Phil's help. It does not matter where the hello.pl file is located as it is only a test file - it matters only when you wanna call it via command line without typing the full address of it. Try and see if you could run hello.pl arg1 arg2 without directly calling the interpreter.

@obetz: I use ActiveState Perl only for ExifTool and because it is the implementation recommended by Phil. Never used any other implementation. I occasionally do Python and JS to help with my visual projects, but more kind of scripts, not real full programs.

obetz

If you want to avoid installing Perl only for ExifTool, I offer a stripped down Strawberry Perl together with an own launcher:

https://oliverbetz.de/pages/Artikel/ExifTool-for-Windows

That's easier to install and lightweight.

P.S.: Just out of curiosity: What was your motivation not to use the "stand-alone Windows executable" offered at the ExifTool site?

Oskar

Quote from: obetz on July 13, 2019, 04:05:17 PM
If you want to avoid installing Perl only for ExifTool, I offer a stripped down Strawberry Perl together with an own launcher:

https://oliverbetz.de/pages/Artikel/ExifTool-for-Windows

That's easier to install and lightweight.

P.S.: Just out of curiosity: What was your motivation not to use the "stand-alone Windows executable" offered at the ExifTool site?

Thank you for your offer! The advertised increased speed of the Perl ExiftTool  ;) I also have the feeling that the full Perl version offers access to all the commands while the executable has a smaller number of available commands.

obetz

Quote from: Oskar on July 15, 2019, 02:12:54 AM
The advertised increased speed of the Perl ExiftTool

Can you point me to the place where higher speed is advertised?

Oliver

Stan Wickham

I poked around the registry

Computer\HKEY_CLASSES_ROOT\.pl
Computer\HKEY_CLASSES_ROOT\Perl_program_file\shell\Execute Perl Program\command

and found that Strawberry Perl decided not to set an Open Command.

Instead, they implemented their own verb, Execute Perl Program, and defined it C:\Perl\Strawberry\perl\bin\perl.exe "%1" %*. That's the same default action that Oskar found to be correct. In his case, with Active Perl, that action was associated with the verb 'Open'. (As a side note, to my new understanding of Windows File Association, the default verb is displayed at the top of the contextual menu that appears when you Right-Click on a file of a given type. Here the file type is '.pl'.)

@ Oskar Your question and sleuthing confirmed that my configuration works. Kudos to the visual artist.

Now on to creating and using the ARGFILE in R.

Oskar

Quote from: obetz on July 15, 2019, 03:11:06 AM
Quote from: Oskar on July 15, 2019, 02:12:54 AM
The advertised increased speed of the Perl ExiftTool

Can you point me to the place where higher speed is advertised?

Oliver

Unfortunately I cannot find it anymore. But I know for sure it was written somewhere. The only reference I could find is here: https://www.exiftool.org/index.html#performance when it speaks of batch processing. As far as I know batch processing is available only for the Perl distribution but not for the Windows executable - am I wrong?

obetz

(...The advertised increased speed of the Perl ExiftTool)

Quote from: Oskar on July 16, 2019, 01:28:35 AM
Unfortunately I cannot find it anymore. But I know for sure it was written somewhere. The only reference I could find is here: https://www.exiftool.org/index.html#performance when it speaks of batch processing. As far as I know batch processing is available only for the Perl distribution but not for the Windows executable - am I wrong?

The "stand-alone Windows executable" has the same batch processing capabilities, including -stay_open.

There are minor differences, e.g. the installed version doesn't have the "parameters taken from magic file names" and a different method of printing the help, but you usually won't notice this.

StarGeek

Quote from: Oskar on July 16, 2019, 01:28:35 AMThe only reference I could find is here: https://www.exiftool.org/index.html#performance when it speaks of batch processing. As far as I know batch processing is available only for the Perl distribution but not for the Windows executable - am I wrong?

That reference is in regards to the common practice of using command line loops to call a program once for each file (see Common Mistake #3), which is especially prevalent among Powershell and Bash experts.  While this is required for some programs, such as FFMpeg, because exiftool's startup hit is so great and it already has powerful batch ability, looping should be avoided with exiftool.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).