473,587 Members | 2,504 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\\Sha redDocs\\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 1436
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\\Sha redDocs\\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\\Sha redDocs\\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.execut e. 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
4890
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 big) problem with my code that someone can point out that may save me some time. TIA CBL
6
10207
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 message: "The process cannot access the file "whatever" because it is being used by another process." I've even tried opening another file using the same streamwriter object before deleting the original file, but it's no use. Something keeps...
5
3379
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. \\10.31.42.10\db\mydb.mdb but the whoever opens their front end first appears to have exclusive access to the database. Anyone else who tries to open the database can open it to a certain extent (as long as the form in question has no data on it,...
1
5374
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: Project: drawing_control, Configuration: Release Win32 ------ 1>Deleting intermediate and output files for project 'drawing_control', configuration 'Release|Win32'
2
3262
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 and arrays of pointers to them. I have gotten the program to compile with gcc on WinXP. If the file i read doesnt have alot of records, it runs thru. But once i add more, it dies. In this program i have 4 files setup to read. The
1
4267
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 trying to write to the file and is throwing an exception (File... in use by another process) whenever the output file (strFileName) is open. I am trying to prevent it from writing to it at all if this is the case... Any insight? Public...
5
1593
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 handling internal information. Than I have web service, that also uses the same classes (I included the file as linked external resource). I included this web service as web reference and used name wsWeb. When I am trying to call the web...
5
8797
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 packages' that include as attachments: a contract (PDF or TIF), a pricing tool (Excel), a companion document (Word). Clerks detach these files into a shared drive file on our intranet. I'm building an 'contract package management' application...
34
5327
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 "<pyshell#10>", line 1, in <module> os.startfile("C:\Documents and Settings\Alex\My Documents\My
0
7854
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8219
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8349
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8221
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5395
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3845
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.