473,224 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Problems opening a file in a shared dir

luke14free
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 1428
It will work if you "map" the network share.
http://www.microsoft.com/windowsxp/u.../mapdrive.mspx
Dec 19 '07 #2
STM
4
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 Expert 512MB
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 Expert 256MB
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
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
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
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
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
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
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
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
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
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
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.