Hello,
I want to open the file 'configuration. smo' that is in directory dir.
Yet, I don't know on which os my program is being run. On Unix I would
say:
f = open(dir + '/configuration.s mo', 'r')
What is the os-independent version of this line?
(I have read the manual of the module os, but I didn't see how to do
it.)
Jörg Schuster 5 1408
I believe you want:
import os
f = open(os.path.jo in(dir, 'configuration. smo'), 'r')
....
Joerg Schuster wrote: Hello,
I want to open the file 'configuration. smo' that is in directory dir. Yet, I don't know on which os my program is being run. On Unix I would say:
f = open(dir + '/configuration.s mo', 'r')
What is the os-independent version of this line?
(I have read the manual of the module os, but I didn't see how to do it.)
Jörg Schuster
--
*************** *************** ******
Andrew Bushnell
Lead Development Engineer
Fluent Inc.
10 Cavendish Court
Centerra Resource Park
Lebanon, NH 03766 aw*@fluent.com
Phone: 603-643-2600, ext. 757
Fax: 603-643-1721 www.fluent.com
*************** *************** ******
Hi,
it`s
import os
f = open( os.path.join( dir , 'configuration. smo' ), 'r' )
HTH,
Gerald
Joerg Schuster schrieb: Hello,
I want to open the file 'configuration. smo' that is in directory dir. Yet, I don't know on which os my program is being run. On Unix I would say:
f = open(dir + '/configuration.s mo', 'r')
What is the os-independent version of this line?
(I have read the manual of the module os, but I didn't see how to do it.)
Jörg Schuster
--
GPG-Key: http://keyserver.veridis.com:11371/search?q=0xA140D634
Thanks, Andrew and Gerald.
Jörg
Gerald Klix schrieb: Hi, it`s
import os f = open( os.path.join( dir , 'configuration. smo' ), 'r' )
*nix-heads everywhere?
For a text file, I would prefer:
f = open( os.path.join( dir , 'configuration. smo' ), 'U' )
and for a binary file:
f = open( os.path.join( dir , 'configuration. smo' ), 'rb' )
That way it also works on Windows.
Thomas Joerg Schuster schrieb:
Hello,
I want to open the file 'configuration. smo' that is in directory dir. Yet, I don't know on which os my program is being run. On Unix I would say:
f = open(dir + '/configuration.s mo', 'r')
What is the os-independent version of this line?
(I have read the manual of the module os, but I didn't see how to do it.)
Jörg Schuster
Joerg Schuster schrieb: Hello,
I want to open the file 'configuration. smo' that is in directory dir. Yet, I don't know on which os my program is being run. On Unix I would say:
f = open(dir + '/configuration.s mo', 'r')
What is the os-independent version of this line?
Did You check this out on Windows? My experience with *nix paths is
that they work. open("C:/bla.txt")
<open file 'C:/bla.txt', mode 'r' at 0x026B4A20>
Kay This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: praba kar |
last post by:
Dear All,
I have one doubt. Is there python.ini
file like php.ini in Php?
Actually php.ini file controls many aspects of
PHP's behavior. The following details of php.ini
will explain about it.
max_execution_time = 5000 ; Maximum execution time
|
by: Lane Friesen |
last post by:
I've developed a new form of client-based, secure 'Web Memory' that
uses the JAVA or dotNET VM to launch a 'terminate and stay
resident' program fragment that maintains persistence between web
pages by program reloading. Web Memory is the basis for an Open Source
e-commerce front end that could reduce web congestion and simplify
online shopping.
If too many people use this technique, then it will not work for
anyone. Bandwidth for Web...
|
by: A_StClaire_ |
last post by:
hi,
I'm working on a project spanning five .cpp files. each file was used
to define a class. the first has my Main and an #include for each of
the other files.
problem is my third file needs to access the class defined in my second
file and I can't figure out how to work this right. if I use an
#include in my third file, my Main gives me a compile-time class
redefinition error. if I don't, the third file can't "see" the second
|
by: elieli_132 |
last post by:
Hi,
My problem is the following:
Made changes to code in form and closed the form.
Now unable to open / design the form.
- Tried copying and pasting - the new one does not open /display.
- Tried compacting / repairing but same situation.
|
by: mbahl |
last post by:
Is there a CRT method to find if a file is open.
Or a way to get the refcount on itz open handles.
| |
by: PengYu.UT |
last post by:
The following code open the file "example.txt" in the current
directory.
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
|
by: Raj |
last post by:
What is the purpose of file system caching while creating a tablespace?
Memory on the test server gets used up pretty quickly after a user
executes a complex query(database is already activated), after some
investgation i found out that most of it being consumed by filesystem
caching... thanks to Liam and Phil Sherman for their valuable
suggestions. Is it safe to turn off filesystem caching on every
tablespaceon the server(i.e. DIO) ??...
|
by: robert.waters |
last post by:
Hello,
I have a main form that is maximized when my application loads; this
main form contains links to all other forms. I've had to specify the
Popup property of these other forms, so that they are not maximized
when they load. Unfortunately, this seems to have had the consequence
of removing them from the Windows taskbar, which makes navigating
between open forms more difficult.
How would you developers deal with navigation between...
|
by: Chuck Anderson |
last post by:
I run Apache 2.0.55, and Php (both 4.4.1 and 5.2.5) on my home PC
(Windows XP). One of the scripts that I run daily needs to access a
secure URL (https://..............). When I am running Php4, it can
open the file.
However, when I run Php5 I (now) get this error message:
"Unable to find the wrapper "https" - did you forget to enable it when
you configured PHP?"
This is new. Last time I messed with this, I merely got:
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |