473,569 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

os listdir access denied when run as a service

Hi All,

I am trying to access a mapped network drive folder. everything works fine
normally. But when i run the application as service I am getting the error

Traceback (most recent call last):
File "docBoxApp. py", line 129, in ?
File "core\PollFiles .pyc", line 332, in doPoll
File "core\PollFiles .pyc", line 47, in createFileList
File "core\PollFiles .pyc", line 25, in addFolderFiles
WindowsError: [Errno 5] Access is denied: 'G:\\DT Hot Folder test/*.*'
below is my code
def addFolderFiles( folder,filelist =[]):
logger=ServerIn terface.getErro rLogger()
folder = folder.encode(' ascii') #convert path to ascii for File Method
for filename in os.listdir(fold er):#line 25
file=os.path.jo in(folder,filen ame)
logger.error("l oop file :"+file);
if os.path.isfile( file):
logger.error("i s file :"+file);
if ((not (file.find(".tm p")>=0)) and (not
(file.find("~") >=0))):
filelist.append (file)
elif os.path.isdir(f ile):
logger.error("f ile is a directory :"+file);
addFolderFiles( file,filelist)

def createFileList( files,folders,f ilelist=[]):
logger=ServerIn terface.getErro rLogger()
for file in files:
file = file.encode('as cii') #convert path to ascii for File Method
if os.path.isfile( file):
if ((not (file.find(".tm p")>=0)) and (not (file.find("~") >=0))):
filelist.append (file)

for folder in folders:
logger.error("g ot a folder :"+folder);
logger.error("i t was in the list :"+folders.__st r__());
addFolderFiles( folder,filelist )
return (1,filelist)

anything I can do about this..
-----------------------------------------------------
Thomas Thomas

May 25 '06 #1
2 3071
Thomas Thomas wrote:
Hi All,

I am trying to access a mapped network drive folder. everything works fine
normally. But when i run the application as service I am getting the error

Traceback (most recent call last):
File "docBoxApp. py", line 129, in ?
File "core\PollFiles .pyc", line 332, in doPoll
File "core\PollFiles .pyc", line 47, in createFileList
File "core\PollFiles .pyc", line 25, in addFolderFiles
WindowsError: [Errno 5] Access is denied: 'G:\\DT Hot Folder test/*.*'
below is my code
def addFolderFiles( folder,filelist =[]):
logger=ServerIn terface.getErro rLogger()
folder = folder.encode(' ascii') #convert path to ascii for File Method
for filename in os.listdir(fold er):#line 25
file=os.path.jo in(folder,filen ame)
logger.error("l oop file :"+file);
if os.path.isfile( file):
logger.error("i s file :"+file);
if ((not (file.find(".tm p")>=0)) and (not
(file.find("~") >=0))):
filelist.append (file)
elif os.path.isdir(f ile):
logger.error("f ile is a directory :"+file);
addFolderFiles( file,filelist)

def createFileList( files,folders,f ilelist=[]):
logger=ServerIn terface.getErro rLogger()
for file in files:
file = file.encode('as cii') #convert path to ascii for File Method
if os.path.isfile( file):
if ((not (file.find(".tm p")>=0)) and (not (file.find("~") >=0))):
filelist.append (file)

for folder in folders:
logger.error("g ot a folder :"+folder);
logger.error("i t was in the list :"+folders.__st r__());
addFolderFiles( folder,filelist )
return (1,filelist)

anything I can do about this..
-----------------------------------------------------
Thomas Thomas

Remember that services run under a different context than the
foreground login. You can configure services to run under
a user context by editing that info in the service control
panel applet under the Log On tab at the top. The default
is to run the service under Local System account which
probably doesn't have any mapped drives.

-Larry Bates
May 25 '06 #2
In message <ma************ *************** ************@py thon.org>,
Thomas Thomas <th****@eforms. co.nz> writes
Hi All,

I am trying to access a mapped network drive folder. everything works fine
normally. But when i run the application as service I am getting the error

Traceback (most recent call last):
File "docBoxApp. py", line 129, in ?
File "core\PollFiles .pyc", line 332, in doPoll
File "core\PollFiles .pyc", line 47, in createFileList
File "core\PollFiles .pyc", line 25, in addFolderFiles
WindowsError : [Errno 5] Access is denied: 'G:\\DT Hot Folder test/*.*'
below is my code
def addFolderFiles( folder,filelist =[]):
logger=ServerIn terface.getErro rLogger()
folder = folder.encode(' ascii') #convert path to ascii for File Method
for filename in os.listdir(fold er):#line 25
file=os.path.jo in(folder,filen ame)
logger.error("l oop file :"+file);
if os.path.isfile( file):
logger.error("i s file :"+file);
if ((not (file.find(".tm p")>=0)) and (not
(file.find("~" )>=0))):
filelist.append (file)
elif os.path.isdir(f ile):
logger.error("f ile is a directory :"+file);
addFolderFiles( file,filelist)

def createFileList( files,folders,f ilelist=[]):
logger=ServerIn terface.getErro rLogger()
for file in files:
file = file.encode('as cii') #convert path to ascii for File Method
if os.path.isfile( file):
if ((not (file.find(".tm p")>=0)) and (not (file.find("~") >=0))):
filelist.append (file)

for folder in folders:
logger.error("g ot a folder :"+folder);
logger.error("i t was in the list :"+folders.__st r__());
addFolderFiles( folder,filelist )
return (1,filelist)

anything I can do about this..
-----------------------------------------------------
Thomas Thomas

This may be relevant. IIRC, when you run a service under the system
account it doesn't have network access. You need to run it under an
account that does have access to the drive.

Regards

Ian
--
Ian Parker
May 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2939
by: Steve | last post by:
Hi, Yesterday I signed up for another dedicated linux server with the hosting company I use and I am having problems getting MySQL 4.1.3 working on it. I've tried just about everything I can think of to login via the MySQL client but get a variation of the following error every time: ERROR 1045 (28000): Access denied for user...
0
2622
by: George | last post by:
Hello, I'm running an ASPX application "WebApplication1" which consumes a web service (service1.asmx) hosted on a machine with IP (128.1.7.x) . The web service is located in the intranet. The web methods can be invoked successfully if "WebApplication1" is located in machines with the same subnet (128.1.7.x). However, it fails if...
3
2196
by: jliusolar | last post by:
Hi I am trying to figure out why an application get this error when I am trying to open the application's asmx file from localhost. I don't have indexing service running(it set as manual and not started). I also created an .aspx file to do testing The .aspx file opens fine in other directory from IE. As long as I put it in the application's...
0
3526
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the original question, the subject line is: ADODB.NET and "Access Denied" I have an ASP.NET page writtein in VB that uses ADODB. I just had to
4
2905
by: Bruce | last post by:
I am developing an ASP.NET web service application. It works fine on my WinXP Prof development machine. But when I send it to a Windows Server 2003 system I get the following error (attached below). I suppose I have some kind of permissions issue on the server? What recommendations can anyone propose? Thanks, -- Bruce
3
7983
by: Shailesh Humbad | last post by:
I figured out what was causing the "Access is Denied" error when calling functions from referenced DLLs in my service. I've tried to be very detailed, so bear with me. It turns out that libraries I made myself were not having this problem, but it only happened with a zip library I downloaded and copied into my program's directory. When...
3
7946
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images C:\Inetpub\wwwroot\RunReportASP is the directory of my virtual directory for my app. In it's properties I did check "Write" as a permission. What else...
4
21696
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the...
6
5550
by: royan | last post by:
Help please! I have the same problem which this post http://groups.google.com/group/microsoft.public.vsnet.vstools.office/browse_thread/thread/91275741fa1e100f/164638c6d6ba3872?lnk=gst&q=System.UnauthorizedAccessException%3A+Access+is+denied.&rnum=1&hl=en#164638c6d6ba3872 When I deploy our ASP.NET Application web form to Windows server 2003...
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.