473,396 Members | 1,996 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,396 software developers and data experts.

Turning off warnings

Hi,

I need to generate a temporary name for a
file and pass it as argument to a shell
script.

Now when I use os.tempnam() or os.tmpnam()
I get a runtime warning about security issues.

I am well aware of them, but in the context of
this application I really don't need to care
about it.

Is there any way to turn the message off?

Thanks,
Paulo

Jul 18 '05 #1
3 11833
Paulo Pinto wrote:
I need to generate a temporary name for a
file and pass it as argument to a shell
script.

Now when I use os.tempnam() or os.tmpnam()
I get a runtime warning about security issues.

I am well aware of them, but in the context of
this application I really don't need to care
about it.

Is there any way to turn the message off?


You can either do so from the commandline, or use the warning module.
You probably want to use the latter.
The documentation for the warnings module can be found at:

http://www.python.org/dev/doc/devel/...-warnings.html

You probably want to do:

warnings.filterwarnings("ignore")

Hope this helps!

Gerrit.

--
12. If the witnesses be not at hand, then shall the judge set a limit,
at the expiration of six months. If his witnesses have not appeared within
the six months, he is an evil-doer, and shall bear the fine of the pending
case.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/

Jul 18 '05 #2
Paulo Pinto wrote:
[...] Now when I use os.tempnam() or os.tmpnam()
I get a runtime warning about security issues. [...]

Is there any way to turn the message off?

import os, warnings
warnings.filterwarnings("ignore", "tempnam")
os.tempnam()

'C:\\DOCUME~1\\GERHAR~1.HAE\\LOCALS~1\\Temp\\2'

-- Gerhard
Jul 18 '05 #3
On Mon, 2003-12-01 at 15:26, Gerrit Holl wrote:
Paulo Pinto wrote:
I need to generate a temporary name for a
file and pass it as argument to a shell
script.

Now when I use os.tempnam() or os.tmpnam()
I get a runtime warning about security issues.

I am well aware of them, but in the context of
this application I really don't need to care
about it.

Is there any way to turn the message off?


You can either do so from the commandline, or use the warning module.
You probably want to use the latter.
The documentation for the warnings module can be found at:

http://www.python.org/dev/doc/devel/...-warnings.html

You probably want to do:

warnings.filterwarnings("ignore")

Hope this helps!


Or use the *updated for security in 2.3* tempfile module

pydoc tempfile

or

http://www.python.org/doc/current/li...-tempfile.html
Regards
Martin

--
Martin Franklin <mf********@gatwick.westerngeco.slb.com>
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Kylotan | last post by:
I have the following code: def IntToRandFloat(x): """Given a 32-bit integer, return a float in """ x = int(x) x = int(x << 13) ^ x return...
0
by: Ivan Shevanski | last post by:
Here's a noob question for everyone which i can't seem to find the answer to on google. . .Is there a way to turn off syntax warnings? -Ivan ...
13
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
22
by: John Fisher | last post by:
void f(int p) { } Many (most?) compilers will report that p is unreferenced here. This may not be a problem as f may have to match some common prototype. Typically pointers to functions are...
4
by: Edward Diener | last post by:
If I set an Xml documentation file in Configuration Properties | Build, a warning is put out for every non-private element in a public class in every file of my assembly when there is no Xml...
1
by: Karthik | last post by:
Hi, For my project I had set the VC++ compiler flag at its highest level ( /W4 ). While it is nice to see the warnings for my code, the project continues to list the warnings in the header files...
3
by: gil | last post by:
Hi, I'm trying to find the best way to work with compiler warnings. I'd like to remove *all* warnings from the code, and playing around with the warning level, I've noticed that compiling with...
1
by: Robert Singer | last post by:
Platform: winXP, excel 2003 Python 2.5.2 XLWriter 0.4a3 (http://sourceforge.net/projects/pyxlwriter/) Is anyone here using this very nice package, for writing excel files? I'm using it on...
3
by: ziycon | last post by:
What would be the pros/cons of turning off error warnings in the website pages like below? What are peoples opinions on this approach? <?php error_reporting(0); ?>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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
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
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...
0
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
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,...

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.