RE: "No Such File or Directory"

2002-10-15 Thread Nikola Janceski

That's not ok.

use File::Path;
mkpath();

if you want that functionality.

> -Original Message-
> From: James Edward Gray II [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 15, 2002 2:14 PM
> To: [EMAIL PROTECTED]
> Subject: "No Such File or Directory"
> 
> 
> Okay, here's a different on, mkdir() is giving me a "No Such File or 
> Directory" error.  I am passing it a string of two directories I want 
> created, one inside the other, but the way I read the entry in 
> Programming Perl, this is okay.  Am I missing something?
> 
> James
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: No such file or directory

2008-05-20 Thread Roman

anthony brooke wrote:

Hello, I know that this is a very common problem, but I am very sure that  the 
file exist in that directory, also its permission is -rwxrwxrwx , why does it 
give such an error ? What are the other potential problems that cause this ? 
Thanks

Send instant messages to your online friends http://uk.messenger.yahoo.com 
  

Anthony
It would help  if you could post a sample of you script and give the 
actuall error.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: No such file or directory

2008-05-21 Thread anthony brooke





anthony brooke wrote:
> Hello, I know that this is a very common problem, but I am very sure that  
> the file exist in that directory, also its permission is -rwxrwxrwx , why 
> does it give such an error ? What are the other potential problems that cause 
> this ? Thanks
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com 
>  
Anthony
It would help  if you could post a sample of you script and give the 
actuall error.


open(RULES, 'rule.pl') || die "Could not open rule file 'rule.pl'. Error 
$!";
Could not open rule file 'rule.pl'. Error No such file or directory at 
/var/www/modperl//ParserGenerator.pm line 368.

Btw, why do I have double forward slash on that shown module ?

When I put these code in /var/www/modperl//ParserGenerator.pm
use Cwd;
die ">>".getcwd."<<";

[Wed May 21 15:17:46 2008] [error] >>/<< at 
/var/www/modperl//ParserGenerator.pm line 44.\n

I think I am confuse now.

Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: No such file or directory

2008-05-21 Thread anthony brooke





anthony brooke wrote:
> Hello, I know that this is a very common problem, but I am very sure that  
> the file exist in that directory, also its permission is -rwxrwxrwx , why 
> does it give such an error ? What are the other potential problems that cause 
> this ? Thanks
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com 
>  
Anthony
It would help  if you could post a sample of you script and give the 
actuall error.


Also I am using mod_perl, is it because of that make my cwd become the top 
directory "/" ? Thanks

Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: No such file or directory

2008-05-21 Thread Jeff Peng
> open(RULES, 'rule.pl')

please use full path if you don't know where you are exactly.

On Wed, May 21, 2008 at 3:45 PM, anthony brooke <[EMAIL PROTECTED]> wrote:


-- 
Jeff Peng - [EMAIL PROTECTED]
Professional Squid supports in China
http://www.ChinaSquid.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: No such file or directory

2008-05-21 Thread anthony brooke



- Original Message 
From: Jeff Peng <[EMAIL PROTECTED]>
To: Perl Beginners 
Sent: Wednesday, May 21, 2008 15:53:00
Subject: Re: No such file or directory

> open(RULES, 'rule.pl')

please use full path if you don't know where you are exactly.

On Wed, May 21, 2008 at 3:45 PM, anthony brooke <[EMAIL PROTECTED]> wrote:


-- 
Jeff Peng - [EMAIL PROTECTED]
Professional Squid supports in China
http://www.ChinaSquid.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


The problem is I am using mod_perl, wherever I am it always show "/" as the 
current working directory. I got to post the problem to 

Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: No such file or directory

2008-05-29 Thread Ken Foskey
On Thu, 2008-05-29 at 11:45 +0100, Mimi Cafe wrote:

> my script is in the same directory as my files, but it cannot find the file
> ABC.txt in open() below.
> 
> foreach my $supplied (@ARGV){
>  # Output file name set of element currently processed.
> 
>  # Open file to read from.
>  open (INPUTFILE, "<", "$supplied") or die "Could not open $supplied: $!\n";
> # Error: No such file or directory.
> }
> 
> Any help
> 
> Mimi



for starters you might want to look at the <> operator:

while( <> ) {
}

Will read each file on the command line in sequence, saves you thinking
about it.

If it is Unix it is case sensitive,  is this your problem?

Are you actually in the directory?   `bin/myscript.pl bin/ABC.txt`



Re: No such file or directory

2008-05-29 Thread Mimi Cafe
I am on Windows so it should not be case-sensitive. The script and all
required files in one folder. I pass 2 arguments to the script and can I can
open open the file in the $ARGV[0].

my $ad_clients = shift @ARGV;

open (ADFILE, "<", $ad_clients) or die "Could not open $ad_clients for
reading: $! \n"; # This works fine!
my @ad_clients = ;
close ADFILE;

my %inputclient;

foreach my $supplied (@ARGV){
open (INPUTFILE, "<", $supplied) or die "Could not open $supplied for
reading: $!\n # This does not works! Error: No such file or directory
Mimi




On 29/05/2008, Ken Foskey <[EMAIL PROTECTED]> wrote:
>
>  On Thu, 2008-05-29 at 11:45 +0100, Mimi Cafe wrote:
>
> my script is in the same directory as my files, but it cannot find the file
> ABC.txt in open() below.
>
> foreach my $supplied (@ARGV){
>  # Output file name set of element currently processed.
>
>  # Open file to read from.
>  open (INPUTFILE, "<", "$supplied") or die "Could not open $supplied: $!\n";
> # Error: No such file or directory.
> }
>
> Any help
>
> Mimi
>
>
>
> for starters you might want to look at the <> operator:
>
> while( <> ) {
> }
>
> Will read each file on the command line in sequence, saves you thinking
> about it.
>
> If it is Unix it is case sensitive,  is this your problem?
>
> Are you actually in the directory?   `bin/myscript.pl bin/ABC.txt`
>
>
>


Re: No such file or directory

2008-05-29 Thread Jeff Peng
On Thu, May 29, 2008 at 6:45 PM, Mimi Cafe <[EMAIL PROTECTED]> wrote:
> my script is in the same directory as my files, but it cannot find the file
> ABC.txt in open() below.
>
> foreach my $supplied (@ARGV){
>  # Output file name set of element currently processed.
>
>  # Open file to read from.
>  open (INPUTFILE, "<", "$supplied") or die "Could not open $supplied: $!\n";
> # Error: No such file or directory.
> }

How do you pass the files to the script?
Using opendir to do it is better I may suggest.


-- 
Jeff Peng - [EMAIL PROTECTED]
Professional Squid supports in China
http://www.ChinaSquid.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: No such file or directory

2008-05-29 Thread Mimi Cafe
> I am on Windows so it should not be case-sensitive. The script and all
> required files in one folder. I pass 3 arguments to the script (script.pl
> file1 file2 file3)and I can open the first file stored in $ARGV[0] as seen
> below:
>
> my $ad_clients = shift @ARGV;
>
> open (ADFILE, "<", $ad_clients) or die "Could not open $ad_clients for
> reading: $! \n"; # This works fine!
> my @ad_clients = ;
> close ADFILE;
>
> my %inputclient;
>
> foreach my $supplied (@ARGV){
> open (INPUTFILE, "<", $supplied) or die "Could not open $supplied for
> reading: $!\n # This does not works! Error: No such file or directory
>
Mimi

>
>
>
>
> On 29/05/2008, Ken Foskey <[EMAIL PROTECTED]> wrote:
>>
>>  On Thu, 2008-05-29 at 11:45 +0100, Mimi Cafe wrote:
>>
>> my script is in the same directory as my files, but it cannot find the file
>> ABC.txt in open() below.
>>
>> foreach my $supplied (@ARGV){
>>  # Output file name set of element currently processed.
>>
>>  # Open file to read from.
>>  open (INPUTFILE, "<", "$supplied") or die "Could not open $supplied: $!\n";
>> # Error: No such file or directory.
>> }
>>
>> Any help
>>
>> Mimi
>>
>>
>>
>> for starters you might want to look at the <> operator:
>>
>> while( <> ) {
>> }
>>
>> Will read each file on the command line in sequence, saves you thinking
>> about it.
>>
>> If it is Unix it is case sensitive,  is this your problem?
>>
>> Are you actually in the directory?   `bin/myscript.pl bin/ABC.txt`
>>
>>
>>
>
>


Re: No such file or directory

2008-05-30 Thread Mimi Cafe
Still cannot see why Perl complains that  Could not open file for reading.
File or directory does exist.
I have modified my script and now using Getopt::Long module instead of the
@ARGV variable. Can someone take a look?

The script is now run with command line options like this:
myscript --master --compare file_name --compare another_file

Here is a section of the script

use strict;
use warnings;
#use diagnostics;
use Getopt::Long;

use constant DEFAULT_REPORTDIR => ".\\compare_report";

my $master_list = "";
my @compare_lists = "";
my $help = "";

Getopt::Long::Configure ("ignorecase");

GetOptions(
 "master=s" => \$master_list,
 "compare:s" => [EMAIL PROTECTED],
 "help|?!" => \$help,
);

usage() if $help;
@compare_lists = split(' ',join(' ',@compare_lists));
foreach (@compare_lists){
 die "File $_ does not exist or it's empty. Please check the file try
again.\n" unless -s $_;
}


#foreach (@compare_lists){print "$_\n";} # This prints the CLI arguments
correctly.
#

my $outputdir = DEFAULT_REPORTDIR;
unless (-d $outputdir){
 mkdir ($outputdir) or die "could not create dir for $outputdir: $!\n";
}

# Read the master list and populate our array.
open (MASTERFILE, "<", $master_list) or die "Could not open $master_list for
reading: $!\n";
my @master_clients = ;
close MASTERFILE;
##
#print "master list starts below:\n";
#foreach (@master_clients){print "$_\n";}exit;
##
my (%inputclient,$list);

# Read the other files and compare the content to the master client list.
foreach $list (@compare_lists){
 # Output file name set of element curerently processed.
 # Open file to read from.
 open(INPUTFH, "<", $list) or die "Could not open $list for reading:
$!\n"; # Could
not open file for reading. File or directory does exist.
 while (){
   chomp;
   $inputclient{"s_"} = $_;
 }
 close INPUTFH;

 #$outputfile = "NOT_IN" . "$outputfile";
 my $outputfile = $list;
 my (@missing_clients, %outputclient);

 open (OUTPUTFILE, ">", $outputfile) || die "Could not open $outputfile:
$!\n";
 foreach my $aditem (@master_clients){
  push (@missing_clients, $aditem) unless exists $inputclient{"$aditem"};
 }



On 29/05/2008, Mimi Cafe <[EMAIL PROTECTED]> wrote:
>
>
>  I am on Windows so it should not be case-sensitive. The script and all
>> required files in one folder. I pass 3 arguments to the script (script.pl
>> file1 file2 file3)and I can open the first file stored in $ARGV[0] as seen
>> below:
>>
>> my $ad_clients = shift @ARGV;
>>
>> open (ADFILE, "<", $ad_clients) or die "Could not open $ad_clients for
>> reading: $! \n"; # This works fine!
>> my @ad_clients = ;
>> close ADFILE;
>>
>> my %inputclient;
>>
>> foreach my $supplied (@ARGV){
>> open (INPUTFILE, "<", $supplied) or die "Could not open $supplied for
>> reading: $!\n # This does not works! Error: No such file or directory
>>
> Mimi
>
>>
>>
>>
>>
>> On 29/05/2008, Ken Foskey <[EMAIL PROTECTED]> wrote:
>>>
>>>  On Thu, 2008-05-29 at 11:45 +0100, Mimi Cafe wrote:
>>>
>>> my script is in the same directory as my files, but it cannot find the file
>>> ABC.txt in open() below.
>>>
>>> foreach my $supplied (@ARGV){
>>>  # Output file name set of element currently processed.
>>>
>>>  # Open file to read from.
>>>  open (INPUTFILE, "<", "$supplied") or die "Could not open $supplied: $!\n";
>>> # Error: No such file or directory.
>>> }
>>>
>>> Any help
>>>
>>> Mimi
>>>
>>>
>>>
>>> for starters you might want to look at the <> operator:
>>>
>>> while( <> ) {
>>> }
>>>
>>> Will read each file on the command line in sequence, saves you thinking
>>> about it.
>>>
>>> If it is Unix it is case sensitive,  is this your problem?
>>>
>>> Are you actually in the directory?   `bin/myscript.pl bin/ABC.txt`
>>>
>>>
>>>
>>
>>
>


Re: No such file or directory exists

2001-10-24 Thread Etienne Marcotte

I run my scripts on both linux and windows and never got this problem..

Always edited with notepad or wordpad.

I run them from the command line or by choosing "open with -> perl" directly
on the file with my win2k.

I really don't know what was causing the problem... but IMO the "no such file
exists" means that it's not found.. if it was the ^M that would mean the file
was found, and then an error would maybe occur when reading it..

Etienne

[EMAIL PROTECTED] wrote:

> That was not the problem.  The problem was the ^M at the end of each line
>
> walter valenti <[EMAIL PROTECTED]>
> Sent by: [EMAIL PROTECTED]
> 10/24/2001 09:11 AM
>
>
> To: [EMAIL PROTECTED]
> cc:     [EMAIL PROTECTED], [EMAIL PROTECTED]
> Subject:Re: No such file or directory exists
>
> Hi,
> look the first line of the script: contains the location of perl's
> interpreter
> Most common are:
> #!/usr/bin/perl
>
> #!/usr/local/bin/perl
>
> Walter
>
> > I'm working with my perl scripts in Linux and Windows.  my scripts were
> > running fine when I ran them as "perl myscript.pl"
> >
> > but when I tried to execute the perl script using only its name
> > (./myscript.pl) then I would get the message "No such file exists"
> > I searched and searched until I found that there were ^M chars at the
> end
> > of each line of my source.  These could not be seen with the text editor
> I
> > was using, but could be seen using "cat -v myscript.pl"
> >
> > I also found a one line perl command that removes all of these
> characters,
> > and then my script worked fine to run as "./myscript.pl".
> > I don't have that command on this machine, but if anybody is having the
> > same trouble, I could email them later with the command.
> >
> > What is the cause of these chars? Is it using a Windows editor to code
> > these scripts, and then running them in Linux?
> > I'm curious to know the cause of this because I spent a good part of 2
> > hours getting that problem sorted out.
> >
> > Thanks,
> > Greg
>
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com

 S/MIME Cryptographic Signature


Re: No such file or directory exists

2001-10-24 Thread Peter Scott

At 09:01 AM 10/24/2001 -0500, [EMAIL PROTECTED] wrote:
>I'm working with my perl scripts in Linux and Windows.  my scripts were
>running fine when I ran them as "perl myscript.pl"
>
>but when I tried to execute the perl script using only its name
>(./myscript.pl) then I would get the message "No such file exists"
>I searched and searched until I found that there were ^M chars at the end
>of each line of my source.  These could not be seen with the text editor I
>was using, but could be seen using "cat -v myscript.pl"
>
>I also found a one line perl command that removes all of these characters,
>and then my script worked fine to run as "./myscript.pl".
>I don't have that command on this machine, but if anybody is having the
>same trouble, I could email them later with the command.
>
>What is the cause of these chars? Is it using a Windows editor to code
>these scripts, and then running them in Linux?

Bingo.  And I'll bet you're being naughty and not using the -w flag (unless 
you're being modern and using 'use warnings', in which case I take it back 
and then some).  Because the ^M at the end of the #! line is being taken as 
part of the invocation, and in order for you to get that error message, it 
would have to be taken as part of the path to perl, which means that you 
don't have any options following it.

>I'm curious to know the cause of this because I spent a good part of 2
>hours getting that problem sorted out.

Often the silliest things do have this effect.  That's why I mentioned this 
one (which can cause other errors) and other 'elementary' errors in my book.
Peter Scott
[EMAIL PROTECTED]
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: No such file or directory exists

2001-10-24 Thread Greg . Froese

elementary? oooh, that hurts =)
but you are right, I should have been using -w




Peter Scott <[EMAIL PROTECTED]>
10/24/2001 10:03 AM

 
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
cc: 
Subject:        Re: No such file or directory exists


At 09:01 AM 10/24/2001 -0500, [EMAIL PROTECTED] wrote:
>I'm working with my perl scripts in Linux and Windows.  my scripts were
>running fine when I ran them as "perl myscript.pl"
>
>but when I tried to execute the perl script using only its name
>(./myscript.pl) then I would get the message "No such file exists"
>I searched and searched until I found that there were ^M chars at the end
>of each line of my source.  These could not be seen with the text editor 
I
>was using, but could be seen using "cat -v myscript.pl"
>
>I also found a one line perl command that removes all of these 
characters,
>and then my script worked fine to run as "./myscript.pl".
>I don't have that command on this machine, but if anybody is having the
>same trouble, I could email them later with the command.
>
>What is the cause of these chars? Is it using a Windows editor to code
>these scripts, and then running them in Linux?

Bingo.  And I'll bet you're being naughty and not using the -w flag 
(unless 
you're being modern and using 'use warnings', in which case I take it back 

and then some).  Because the ^M at the end of the #! line is being taken 
as 
part of the invocation, and in order for you to get that error message, it 

would have to be taken as part of the path to perl, which means that you 
don't have any options following it.

>I'm curious to know the cause of this because I spent a good part of 2
>hours getting that problem sorted out.

Often the silliest things do have this effect.  That's why I mentioned 
this 
one (which can cause other errors) and other 'elementary' errors in my 
book.
Peter Scott
[EMAIL PROTECTED]
http://www.perldebugged.com






Re: No such file or directory exists

2001-10-24 Thread Peter Scott

At 10:12 AM 10/24/2001 -0500, [EMAIL PROTECTED] wrote:
>elementary? oooh, that hurts =)

Hey, everyone does it (or something like it), that's the only reason to 
call it elementary - because we manage to keep making the same mistakes and 
forgetting to check the obvious.  You want to know how many times I've 
hunted down the bug that turned out to be typing #!/usr/bin/prel?  Or 
leaving the semicolon out after use strict?  A few days ago I thought I was 
so hot for reporting how perl cored when I accidentally typed perl -duse 
strict.  Until Jarrko pointed out that this was using the -u flag.  Doh.

The help desk people who start by asking the user whether the machine is 
plugged in don't seem so deserving of scorn as they are usually portrayed...

>but you are right, I should have been using -w

Oh, you'd still have a problem on 5.004 (an even more perplexing error 
message).  But at least then we'd be able to tell that you'd enabled 
warnings :-)
Peter Scott
[EMAIL PROTECTED]
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]