I was testing the functionality of PDF::Tk by installing in cpan module and installed the pdftk binary file and the path to variable and tried running source code.
source code:
use PDF::Tk;
my $doc = PDF::Tk->new( pdftk => '/apps/free/pdftk/' );
$doc->call_pdftk( 'input.pdf', 'outPDF.pdf', 'cat', '1-14' );
getting error as below:
pdftk input.pdf cat 1-14 releasenote.pdf failed: -1 at
/usr/lib/perl5/site_perl/5.10.0/PDF/Tk.pm line 73.
please guide me in resolving it.
Seems you are passing the wrong argument to the constructor of PDF::Tk. Have a look here.
You're supposed to pass a hash, with the key pdftk, and this should be the path of the executable, not a directory. As you can see here, this will be executed via system, so of course, executing a directory does not work.
To clarify, you should be using:
my $doc=PDF::Tk->new(pdftk => '/path/to/pdftk/executable');
If your pdftk executable is /usr/bin/pdftk, then you do not have to pass it at all as this is the default.
for testing the encryption function (by default 128 bit encryption) , i created a pdf file 'apps.pdf' with password protected 'abcd' as password.
source code 1:
use PDF::Tk;
my $doc=PDF::Tk->new(pdftk=>'/apps/free/pdftk/1.44/bin/pdftk');
$doc->call_pdftk('apps.pdf', '1.128.pdf', 'owner_pw', 'abcd');
getting error:
Error: Unexpected command-line data:
owner_pw
where we were expecting an input PDF filename,
operation (e.g. "cat") or "input_pw". Exiting.
Errors encountered. No output created.
Done. Input errors, so no output created.
pdftk apps.pdf owner_pw abcd 1.128.pdf failed: 256 at /usr/lib/perl5/site_perl/5.10.0/PDF/Tk.pm line 73.
note: created a new pdf 'apps.pdf' with Document Open Password as 'abcd' and permission Password as 'abcd123'.
Please let me know how to resolve it.
Related
I am relatively new to the world of coding, so I am having trouble resolving an issue when running TranslocWrapper.pl tutorial_metadata.txt preprocess/ results/ --threads 2. I am trying to run the HTGTS Pipeline according to this GitHub project. This is the full error:
. Library Genome Chr Start End Strand
1 RAG1A_SRep2 hg19 chr11 36594878 36595030 -
Metadata error: chr must be valid at /home/micah/transloc_pipeline/bin/TranslocWrapper.pl line 285.
main::check_validity_of_metadata('HASH(0x2903ac8)') called at /home/micah/transloc_pipeline/bin/TranslocWrapper.pl line 248
main::read_in_meta_file() called at /home/micah/transloc_pipeline/bin/TranslocWrapper.pl line 90
I have already double-checked the successful installation of the Software Dependencies, so everything should be all good, but I am having trouble interpreting the "Metadata error: chr must be valid at ..." line. If it helps, these are the specific lines that are being called in the error:
TranslocWrapper.pl line 285:
croak "Metadata error: chr must be valid" unless grep { $_ eq $expt->{chr} } #chrlist;
TranslocWrapper.pl line 248:
check_validity_of_metadata($expt);
TranslocWrapper.pl line 90:
read_in_meta_file;
Thanks in advance for the help!
So the error is saying that one of the sequence characters in the metadata file is not present in the sequence's assembly file.
Given that this is the provided example you should assume that the data is correct and your invocation is faulty.
Have you done the TranslocPreprocess.pl preprocessing steps?
If you have try looking at the first line of the metadata file, identify the assembly entry. Ensure that the assembly file exists and that it contains the required sequence.
One common problem with this kind of code is the case of the filenames. The examples are designed to be run in Linux where filename case matters. Windows likes to pretend that case doesn't matter, this can cause problems. If you are running this code from Microsoft Windows or extracted any of the archives from within Windows this is a likely cause of the error.
I am using unoconv to convert an ods spreadsheet to a csv file.
Here is the command:
unoconv -vvv --doctype=spreadsheet --format=csv --output= ~/Dropbox
/mariners_site/textFiles/expenses.csv ~/Dropbox/Aldeburgh/expenses
/expenses.ods
It saves the output file in the same directory as the source file, not in the specified directory. The error message is:
Output file: /home/richard/Dropbox/mariners_site/textFiles/expenses.csv
unoconv: UnoException during export phase:
Unable to store document to file:///home/richard/Dropbox/mariners_site
/textFiles/expenses.csv (ErrCode 19468)
I'm sure that this worked initially, but it has since stopped.
I have checked for permissions and they are identical for both directories.
I translated ErrCode 19468 for you and it boils down to meaning ERRCODE_SFX_DOCUMENTREADONLY.
You can find more information about the specific meaning of LibreOffice ErrCode numbers from the unoconv documentation at: https://github.com/dagwieers/unoconv/blob/master/doc/errcode.adoc
The clue here is that you have a whitespace-character between --output= and the filename (--output= ~/Dropbox
/mariners_site/textFiles/expenses.csv) and because of that unoconv gets an empty output value (which means the current directory) and is given 2 files. And that explains why you get this specific error IMO
for testing the encryption function (by default 128 bit encryption) , i created a pdf file 'apps.pdf' with password protected 'abcd' as password.
source code 1:
use PDF::Tk;
my $doc = PDF::Tk->new( pdftk => '/apps/free/pdftk/1.44/bin/pdftk' );
$doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abcd' );
getting error:
Error: Unexpected command-line data:
owner_pw
where we were expecting an input PDF filename,
operation (e.g. "cat") or "input_pw". Exiting.
Errors encountered. No output created.
Done. Input errors, so no output created.
pdftk apps.pdf owner_pw abcd 1.128.pdf failed: 256 at /usr/lib/perl5/site_perl/5.10.0/PDF/Tk.pm line 73.
note: created a new pdf 'apps.pdf' with Document Open Password as 'abcd' and permission Password as 'abcd123'. Please let me know how to resolve it.
Replace line "$doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abcd' );" with command lines
system('/apps/free/pdftk/1.44/bin/pdftk', 'apps.pdf', 'output', '1.128.pdf', 'owner_pw', 'abcd', 'user_pw', 'Oct1234');
"owner_pw" contains the permission password and "user_pw" contain open document password.
Result is : 1.128.pdf is created with security passwords.
just starting to use Perl here. I previously have successfully used backticks to capture system command output in Perl, such as:
my #sysOut = `cleartool checkout -nc \"$file\"`; # works fine!
but I have run into some trouble, and even after looking around for some time I didn't find the solution to this problem. I am trying to write a Perl script to check in a list of checked out files (#allfiles) using cleartool, except if any are identical to their predecessor, then un-checkout them.
The way I am (...failing at!) detecting whether they are identical or not is to get the output from the check in attempt, see if it matches /error.*identical/i, and then if so uncheckout the file. However, for some reason the output seems to bypassing the array I am passing it into.
See code which generates this problem:
foreach my $file (#allfiles){
chomp( my #checkInErr = `cleartool checkin -nc \"$file\"`);
foreach my $err (#checkInErr) { # if no error, checkin done
if ($err =~ m/error.*identical/i) { # if there is error:
print $err;
print "No change detected: unchecking out.\n"; # uncheckout same version
system "cleartool uncheckout -rm -cact \"$file\"";
}
}
}
Here is my command line output (as if I had just used a system() call):
cleartool: Error: Unable to check in "a5TI.txt".
cleartool: Error: By default, won't create version with data identical to predecessor.
cleartool: Error: Unable to check in "a6cm.txt".
cleartool: Error: By default, won't create version with data identical to predecessor.
cleartool: Error: Unable to check in "a6FT.txt".
cleartool: Error: By default, won't create version with data identical to predecessor.
cleartool: Error: Unable to check in "a6pm.txt".
cleartool: Error: By default, won't create version with data identical to predecessor.
cleartool: Error: Unable to check in "a6TI.txt".
cleartool: Error: By default, won't create version with data identical to predecessor.
SOLUTION: check std error stream as well when grabbing output (in retrospect this makes sense as I was trying to parse error messages... oh well)
my #checkInErr = `cleartool checkin -nc \"$file\" 2>&1`;
It's possible the error output from cleartool is not coming out on Standard Output (stdout). With any luck, it's coming out on Standard Error (stderr). If so, this should work:
system "cleartool uncheckout -rm -cact \"$file\" 2>&1";
I installed moodle 1.9.12 and now I want to use Algebra notation in content. I enable "TeX Notation" and "Algebra Notation" in administrator panel and also install mimetext and dvips and Imagemagic on the server. fortunately Tex Notation works fine but I got the following error for Algebra:
sh: /var/www/html/moodle/filter/tex/mimetex.linux: not found
The shell command
"/var/www/html/moodle/filter/tex/mimetex.linux" -e "/var/www/moodledata/filter/algebra/de06d6c44d98ba4e42dffca988bf530b.gif" -- '\Large \frac{\sin\left(z\right)}{x^{2}+y^{2}}'
returned status = 127
File size of mimetex executable /var/www/html/moodle/filter/tex/mimetex.linux is 830675
The file permissions are: 100775
The md5 checksum of the file is 56bcc40de905ce92ebd7b083c76e019e
Image not found!
Note: /var/www/html/moodle/filter/tex/mimetex.linux exists on the server and is executable!!!
What is the problem?? Any idea?????
From what you have described, calling the general tex filter debug page works and does not show up the same error.
/filter/tex/texdebug.php works, but /filter/algebra/algebradebug.php does not.
If this is the case, perhaps you could check for an open_basedir, or safe_mode_exec_dir being set to include the current working directory, or otherwise restricting the execution of /var/www/html/moodle/filter/tex/mimetex.linux, while the current working directory is /var/www/html/moodle/filter/algebra.
You could look at this by visiting /admin/phpinfo.php at your site, and look carefully at the effective values of open_basedir, safe_mode and safe_mode_exec_dir.
You could also check the apache error log or add the following lines to the top of the algebra debug php file, and you might see some extra error messages:
$CFG->debug = 6143 ;
$CFG->debugdisplay= 1 ;
Hope that helps