Hello.
Under Gentoo Linux, I issue:
$ python timeit.py
python: can't open file 'timeit.py'
$ ls -al /usr/lib/python2.3/timeit.py
-rw-r--r-- 1 root root 9833 Oct 19 02:17 /usr/lib/python2.3/timeit.py
But if I specify the full path, it works:
$ python /usr/lib/python2.3/timeit.py -n 1 "pass"
1 loops, best of 3: 3.1 usec per loop
Any ideas how can I fix this? I think it may have to do with where
Python looks for modules, but I am not sure.
Thanks in advance. 2 4093
Aggelos I. Orfanakos wrote: Under Gentoo Linux, I issue:
$ python timeit.py python: can't open file 'timeit.py' $ ls -al /usr/lib/python2.3/timeit.py -rw-r--r-- 1 root root 9833 Oct 19 02:17 /usr/lib/python2.3/timeit.py
But if I specify the full path, it works:
$ python /usr/lib/python2.3/timeit.py -n 1 "pass" 1 loops, best of 3: 3.1 usec per loop
Any ideas how can I fix this? I think it may have to do with where Python looks for modules, but I am not sure.
if you pass a filename to the python interpreter, python uses that file as
a script. it doesn't search for files.
in Python 2.4, you can use "python -m timeit" to make it search for a
module, and use it as a script.
in earlier versions, create a symlink from your personal bin directory, or
use a small shell script to run the python script.
</F>
OK, the symbolic link solved the "problem". I thought that there was
something wrong with my Python configuration; that's why I asked in the
first place.
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: 2mc |
last post by:
Generally speaking, if one had a list (from regular Python) and an
array (from Numerical Python) that contained the same number of
elements, would a While loop or a For loop process them at the same
speed? Or, would the array process faster?
I'm new to Python, so my question may expose my ignorance. I
appreciate anyone's effort to help me understand.
Thanks. It is much appreciated.
|
by: Stephen C. Waterbury |
last post by:
This seems like it ought to work, according to the
description of reduce(), but it doesn't. Is this
a bug, or am I missing something?
Python 2.3.2 (#1, Oct 20 2003, 01:04:35)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> d1 = {'a':1}
>>> d2 = {'b':2}
>>> d3 = {'c':3}
|
by: Guyon Morée |
last post by:
Hi all,
I am working on a Huffman encoding exercise, but it is kinda slow. This is
not a big problem, I do this to educate myself :)
So I started profiling the code and the slowdown was actually taking place
at places where I didn't expect it.
after I have created a lookup-table-dictionary with encodings like
{'d':'0110', 'e':'01' etc} to encode the original text like this:
|
by: Bill |
last post by:
I've written a small program that, in part, reads in a file and parses
it. Sometimes, the file is gzipped. The code that I use to get the
file object is like so:
if filename.endswith(".gz"):
file = GzipFile(filename)
else:
file = open(filename)
Then I parse the contents of the file in the usual way (for line in
|
by: robert |
last post by:
Turning algs for old NumPy modules into numpy code I suffer from this:
Upon further processing of returns of numpy calculations, lots of data in an apps object tree will become elementary numpy types.
First there is some inefficiency in calculations. And then you get data inflation and questionable dependencies - e.g. with pickle,ZODB,mpi's ... :
0.0...
| |
by: yinglcs |
last post by:
Hi,
I am following this python example trying to time how long does an
operation takes, like this:
My question is why the content of the file (dataFile) is just '0.0'?
I have tried "print >>dataFile, timeTaken" or "print >>dataFile,str(
timeTaken)", but gives me 0.0.
Please tell me what am I missing?
|
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 349 open ( +7) / 3737 closed (+25) / 4086 total (+32)
Bugs : 939 open (-12) / 6648 closed (+60) / 7587 total (+48)
RFE : 249 open ( -8) / 278 closed (+12) / 527 total ( +4)
New / Reopened Patches
______________________
|
by: silverburgh.meryl |
last post by:
Hi,
I am using timeit to time a global function like this
t = timeit.Timer("timeTest()","from __main__ import timeTest")
result = t.timeit();
But how can i use timeit to time a function in a class?
class FetchUrlThread(threading.Thread):
|
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,...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
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();...
|
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...
| |