473,513 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems opening a file in a shared dir

luke14free
79 New Member
Hello,
I'm using Windows XP and Windows Server 2003 for a work.
I need to copy a file from shared dir to my pc. This is my file location.
\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma
I tried to use os.system and open:
Expand|Select|Wrap|Line Numbers
  1. open("\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma","r").read()
  2. Traceback (most recent call last):
  3.   File "<pyshell#3>", line 1, in <module>
  4.     open("\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma","r").read()
  5. IOError: [Errno 2] No such file or directory: '\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma'
And system returns nothing...But nothing happens too. (in fact cmd tells me that the folder path is unknown). I've got all the right privileges, because using explorer I can get my file.
Thank you,
Luca
Dec 18 '07 #1
5 1431
rogerlew
15 New Member
It will work if you "map" the network share.
http://www.microsoft.com/windowsxp/u.../mapdrive.mspx
Dec 19 '07 #2
STM
4 New Member
Hello,
I'm using Windows XP and Windows Server 2003 for a work.
I need to copy a file from shared dir to my pc. This is my file location.
\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma
I tried to use os.system and open:
Expand|Select|Wrap|Line Numbers
  1. open("\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma","r").read()
  2. Traceback (most recent call last):
  3.   File "<pyshell#3>", line 1, in <module>
  4.     open("\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma","r").read()
  5. IOError: [Errno 2] No such file or directory: '\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma'
And system returns nothing...But nothing happens too. (in fact cmd tells me that the folder path is unknown). I've got all the right privileges, because using explorer I can get my file.
Thank you,
it s just a guess, but try writing the open call like this:
Expand|Select|Wrap|Line Numbers
  1. open(r'\NOTEBOOK\SharedDocs\Musica\Musica campione\a.wma','r').read()
the way you wrote it may have problems with escape sequences
let me know if that was the problem
Dec 22 '07 #3
ilikepython
844 Recognized Expert Contributor
Hello,
I'm using Windows XP and Windows Server 2003 for a work.
I need to copy a file from shared dir to my pc. This is my file location.
\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma
I tried to use os.system and open:
Expand|Select|Wrap|Line Numbers
  1. open("\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma","r").read()
  2. Traceback (most recent call last):
  3.   File "<pyshell#3>", line 1, in <module>
  4.     open("\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma","r").read()
  5. IOError: [Errno 2] No such file or directory: '\\NOTEBOOK\\SharedDocs\\Musica\\Musica campione\\a.wma'
And system returns nothing...But nothing happens too. (in fact cmd tells me that the folder path is unknown). I've got all the right privileges, because using explorer I can get my file.
Thank you,
Luca
I'm not sure but the problem might be because of the space in the path. Try calling it like this:
Expand|Select|Wrap|Line Numbers
  1. open/os.system('"\\NOTEBOOK\\......\\a.wma"')
  2.  
Dec 23 '07 #4
ghostdog74
511 Recognized Expert Contributor
demo
Expand|Select|Wrap|Line Numbers
  1. >>> import os
  2. >>> os.path.join("c:\\","test","file with space.txt")
  3. 'c:\\test\\file with space.txt'
  4. >>> os.path.exists (os.path.join("c:\\","test","file with space.txt")) 
  5. True
  6. >>> f=open(os.path.join("c:\\","test","file with space.txt"))
  7. >>> f.read()
  8. 'qweqwd'
  9. >>> f.close()
  10.  
ensure that you have a valid drive letter assigned to your mapped drive.
Dec 23 '07 #5
luke14free
79 New Member
Problem solved using os.system and win32api.execute. I wasn't able to map drives because the program works on more than 30pcs...it was kinda impossible...
Thanks for help,
Luce
Jan 10 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
4879
by: me | last post by:
I'm also having problems getting the bulk insert to work. I don't know anything about it except what I've gleened from BOL but I'm not seeming to get anywhere...Hopefully there is some little (or...
6
10204
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error...
5
3375
by: DeanL | last post by:
Hi all, I'm having a few problems with a shared access 97 db. I have the database split with the tables on the server and everything else in "client" front ends with links to the tables, e.g....
1
5371
by: electrixnow | last post by:
Help!, I need to compile this code with static libs so it run on another XP machine that does'nt have MS Studio installed. When I compile now I get an ERROR: 1>------ Rebuild All started:...
2
3253
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres...
1
4262
by: jtertin | last post by:
I am currently using the following code to make sure a file is writable (i.e. is not in use) by using the CanWrite method of the FileStream object. Using the code below, the TextWriter is still...
5
1583
by: Simon | last post by:
I have problem with namespaces. I have a program that consumes the web service and has for instance names space nsProgram. In this program I have defined several classes that I use for storing and...
5
8787
LAD
by: LAD | last post by:
Using Access 2003 on Windows 2000. My Skill Level: Med Low (Some VBA, okay with Access) Form: Single View - based on Query of single Table to sort by field. Application: Dealers email 'contract...
34
5298
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File...
0
7265
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,...
0
7171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
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,...
0
7545
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7539
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...
0
5692
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,...
1
5095
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...
0
3240
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...
0
461
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...

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.