473,503 Members | 10,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Path

11 New Member
I think this is really a trivial question to ask,but still i cant figure out d way to do it
I have a class library which refers to certain text files when running .this class library i have referred in another project.the path i have given for the class library o open textfile is System.AppDomain.CurrentDomain.BaseDirectory+textf ile name...the library did compile ,but when i run the project in which i have referred the library it refers to the project directory...n gives filenot found exception
wat shud be dun??
Thanks
Oct 16 '07 #1
5 1107
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Hi,
this error is a runtime error and not a compile time error

Have you got more details about this exception?
Generally it should have details of the full file path where is was expecting the file to be in.

That should be your key to fixing this issue
Oct 16 '07 #2
sneha0608
11 New Member
Yes its runtime..it gives the fullpath as the project in which m using the library paths debug folder...its searching it der...but the issue is that my library acceses those text files,so ideally they shud be present in the library.placing those files in the debug folder solves d issue but i feel its not rite way to do it
Oct 16 '07 #3
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Since you have 2 seperate projects (since your library is your own creation, and your project using the file)
you could either look into using a common directory.. (maybe a temp directory hardcoded into them, so they know where the file is placed)

Or,...I just thought about this one..
since your library should be the primary project, you could define the path of the file in the library, and the secondry project (the project acccessing the library) will get the path of the file from the library.
So the library maintains the path where the file is stored.

cheers (hope i made sense there to you)
Oct 16 '07 #4
sneha0608
11 New Member
Hey Thank You...The latter will work..:)
Oct 16 '07 #5
Plater
7,872 Recognized Expert Expert
They were behaving exactly as you programmed them to, but probably not how you thought they would.
You told it to search in the FIRST directory it would "look for assemblies". Which is the current working directory, which is the debug directory. So it will search there for them.

You should note however that dependong on your namespaces that you use, it won't ALWAYS be the current working directory.
That can be found with:
System.Environment.CurrentDirectory
Oct 16 '07 #6

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

Similar topics

31
3869
by: John Roth | last post by:
I'm adding a thread for comments on Gerrit Holl's pre-pep, which can be found here: http://tinyurl.com/2578q Frankly, I like the idea. It's about time that all of the file and directory stuff...
9
3586
by: Bengt dePaulis | last post by:
I have a local directory that I want to include in my sys.path How to save it permanently? Regards /Bengt
70
4016
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
34
3224
by: Reinhold Birkenfeld | last post by:
Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. It still can be found in CVS:...
2
23361
by: Rob Cowie | last post by:
Hi, Given a string representing the path to a file, what is the best way to get at the filename? Does the OS module provide a function to parse the path? or is it acceptable to split the string...
1
5834
by: William Stacey [MVP] | last post by:
I need a bullet proof way to combine a root and a relative path to form a FQ rooted path (similar to a VDir in IIS). Path.Combine alone will not do the job in all cases. I also need to be sure...
4
3236
by: python | last post by:
Bad file names, i.e. filenames the OS considers illegal, will cause functions in the os.path module to raise an error. Example: import os.path print os.path.getsize( 'c:/pytest/*.py' ) On...
34
5297
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...
8
11461
by: moondaddy | last post by:
I'm posting code for a user control ( FunctionConnectorSelector) below which has 3 content controls in it. each content control uses a style from a resource dictionary merged into the app.xaml...
6
4037
by: bukzor | last post by:
I have to go into these convulsions to get the directory that the script is in whenever I need to use relative paths. I was wondering if you guys have a better way: from os.path import dirname,...
0
7207
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
7095
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
7361
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
5602
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
5026
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
4693
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...
0
3183
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
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.