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

New to group

Hi Everyone

I am new to programming in general although I have read alot and
done alot of experimentation as well as researched afew languages
namely java python and visual basic . My conclusion is that python
is one of the best because it eliminates the need to learn about
access modifiers and form handlers so a user can concentrate
primarliy on the nuts and bolts of the language .

i have come across my first exeption using randrange . The exeption
is " no such attribute " in module random

platform is xp home and the python build is activestate 2.5

All help much appreciated !

Mar 24 '08 #1
8 1094
What does the code look like?
Mar 24 '08 #2
On Mar 24, 1:53 pm, pythonnubie <exxf...@hotmail.comwrote:
Hi Everyone

I am new to programming in general although I have read alot and
done alot of experimentation as well as researched afew languages
namely java python and visual basic . My conclusion is that python
is one of the best because it eliminates the need to learn about
access modifiers and form handlers so a user can concentrate
primarliy on the nuts and bolts of the language .

i have come across my first exeption using randrange . The exeption
is " no such attribute " in module random

platform is xp home and the python build is activestate 2.5

All help much appreciated !
Please post the code that throws this error along with the entire
traceback.

Thanks,

Mike
Mar 24 '08 #3
On Mar 24, 11:57*am, Jeff <jeffo...@gmail.comwrote:
What does the code look like?
# Random Access
# Demonstrates string indexing
# Michael Dawson - 1/27/03

import random

word = "index"
print "The word is: ", word, "\n"

high = len(word)
low = -len(word)
for i in range(10):
position = random.randrange(low, high)
print "word[", position, "]\t", word[position]

raw_input("\n\nPress the enter key to exit.")

The code is an exerp from a chm file . I am petty sutre I am
nmot getting a char map error from the copy/paste ! it looks
simple enough !

Mar 24 '08 #4
On Mar 24, 2:53 pm, pythonnubie <exxf...@hotmail.comwrote:
Hi Everyone

I am new to programming in general although I have read alot and
done alot of experimentation as well as researched afew languages
namely java python and visual basic . My conclusion is that python
is one of the best because it eliminates the need to learn about
access modifiers and form handlers so a user can concentrate
primarliy on the nuts and bolts of the language .

i have come across my first exeption using randrange . The exeption
is " no such attribute " in module random

platform is xp home and the python build is activestate 2.5
Welcome aboard!

There's definitely a randrange function in the random module, so
something else must be wrong. To get the most out of this list and
minimize wasted bandwidth, the most effective way usually consists of
copying and pasting:
1. The offending code (or just the relevant part if it's too big).
2. The full traceback of the raised exception.

Regards,
George
Mar 24 '08 #5
On Mar 24, 3:03 pm, pythonnubie <exxf...@hotmail.comwrote:
On Mar 24, 11:57 am, Jeff <jeffo...@gmail.comwrote:
What does the code look like?

# Random Access
# Demonstrates string indexing
# Michael Dawson - 1/27/03

import random

word = "index"
print "The word is: ", word, "\n"

high = len(word)
low = -len(word)
for i in range(10):
position = random.randrange(low, high)
print "word[", position, "]\t", word[position]

raw_input("\n\nPress the enter key to exit.")

The code is an exerp from a chm file . I am petty sutre I am
nmot getting a char map error from the copy/paste ! it looks
simple enough !
It works fine on on Windows with standard Python 2.5. Something is
probably wrong with your ActiveState installation.

George
Mar 24 '08 #6
pythonnubie wrote:
On Mar 24, 11:57 am, Jeff <jeffo...@gmail.comwrote:
>What does the code look like?

# Random Access
# Demonstrates string indexing
# Michael Dawson - 1/27/03

import random
Make sure that you do not have a random.py module in the current directory.
Python checks the current directory for modules before the standard directories.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Mar 24 '08 #7
pythonnubie wrote:
The exeption
is " no such Â*attribute " in Â*module random
Is your own source file named "random.py" by chance? If so, rename it, and
be sure to remove the leftover random.pyc file as well.
Jeffrey
Mar 24 '08 #8
pythonnubie wrote:
On Mar 24, 11:57Â*am, Jeff <jeffo...@gmail.comwrote:
>What does the code look like?

# Random Access
# Demonstrates string indexing
# Michael Dawson - 1/27/03

import random

word = "index"
print "The word is: ", word, "\n"

high = len(word)
low = -len(word)
for i in range(10):
position = random.randrange(low, high)
print "word[", position, "]\t", word[position]

raw_input("\n\nPress the enter key to exit.")

The code is an exerp from a chm file . I am petty sutre I am
nmot getting a char map error from the copy/paste ! it looks
simple enough !
You have probably called your script random.py, and now it imports itself
instead of the random.py module in Python's standard library.

Rename your script to myrandom.py, remove the compiled version random.pyc in
the same folder, and you should be able to run it successfully.

Peter
Mar 24 '08 #9

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

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
2
by: Tom Loach | last post by:
Our system administrator set up an NT server group in order to allow our users to login to our application via https to our sql server. The group appears as a User in SQL Server when you look at...
4
by: Chad Richardson | last post by:
I've always been mistified why you can't use a column alias in the group by clause (i.e. you have to re-iterate the entire expression in the group by clause after having already done it once in the...
2
by: BillD | last post by:
I'm trying to derive a schema from a base schema. I want to redefine a "group" from the base schema in my derived schema in order to add more options to the "choice" aggregate (see schema1.xsd...
16
by: michael | last post by:
Is it possible to get all href URLs contained in a unordered list and place them in an array? Or in fact two different arrays, differently named one for each <ul> group? <ul> <li><a...
7
by: Darin | last post by:
I have a report that sub-totals on a group, then grand-totals at the report footer. If there's only one group, the sub-total and grand total are redundant, so I only want to show one of them. I...
1
by: David Horowitz | last post by:
Hi folks. I need to create a report that has a Group Header that pulls certain data from the Detail section. It's something like this: +--Report---------------------------------------- |...
7
by: Sameh Ahmed | last post by:
Hello there IsInrole gives ya the means to check if the current or impersonated user belongs to a specific windows role or group. is there a way to do the same without using ADSI to check if...
2
by: jon|k | last post by:
hi all-- i need to do a transformation that removes duplicates (among other things). to accomplish that, i'm trying to use for-each-group, but it doesn't work. i need to select for duplicates by...
3
by: Sebastian | last post by:
Hello all I have a report where I have two nested groups. I know there are only three standard options for running sum: None, Over Group and Over All. I have a MyTextBox in detail section where...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.