# Help with a basic python error

**URL:** <https://discourse.numenta.org/t/help-with-a-basic-python-error/4411>\
**Category:** NuPIC\
**Tags:** newbie\
**Created:** [August 27, 2018, 1:17pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411 "2018-08-27T13:17:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 27, 2018, 1:17pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/1 "2018-08-27T13:17:33Z")

</div>

help plz, @rhyolight and @learner  
traceback (most recent call last):  
encoding =encode (reader.next())  
StopIteration  
this is the input data

 ![sets](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/a/afdf6268ba9e3668dca5d90c814d52a0ff6ee3c7.png)

---

<div class="post-metadata">

**Author:** ![learner](https://avatars.discourse-cdn.com/v4/letter/l/b782af/32.png) [@learner](https://discourse.numenta.org/u/learner)\
**Post date:** [August 27, 2018, 1:31pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/2 "2018-08-27T13:31:32Z")

</div>

I’m using NuPIC 1.0.5, but your error looks like a problem with your file. Did you edit it? It should have 3 header rows and 4391 rows of data. [See here](https://github.com/psdyer/NuPIC-Algorithm-API-Example/blob/master/one_hot_gym_data.csv).

---

<div class="post-metadata">

**Author:** ![sheiser1](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/sheiser1/32/766_2.png) [@sheiser1](https://discourse.numenta.org/u/sheiser1)\
**Post date:** [August 27, 2018, 2:23pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/3 "2018-08-27T14:23:11Z")

</div>

Hy @way-sal, I think it’d help to see more of your code since I’m not sure how you initialized ‘encode’. I’d check how yours lines up with this section of @learner’s document (or the API demo):

> record = [‘7/2/10 0:00’, ‘21.2’]
> 
> # Convert date string into Python date object
> 
> dateString = dt.strptime(record[0], “%m/%d/%y %H:%M”)
> 
> # Convert data value string into float
> 
> consumption = float(record[1])
> 
> # To encode, we need to provide numpy arrays for the encoders to populate
> 
> timeOfDayBits = np.zeros(timeOfDayEncoder.getWidth())  
> weekendBits = np.zeros(weekendEncoder.getWidth())  
> consumptionBits = np.zeros(scalarEncoder.getWidth())
> 
> # Now we call the encoders to create bit representations for each value
> 
> timeOfDayEncoder.encodeIntoArray(dateString, timeOfDayBits)  
> weekendEncoder.encodeIntoArray(dateString, weekendBits)  
> scalarEncoder.encodeIntoArray(consumption, consumptionBits)
> 
> # Concatenate all these encodings into one large encoding
> 
> encoding = np.concatenate((timeOfDayBits, weekendBits, consumptionBits))

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 27, 2018, 2:41pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/4 "2018-08-27T14:41:22Z")

</div>

@learnerand @sheiser1 thanks, i solve those problems but now i have this:  
en français  
paramètre non valide -15  
paramètre non valide -15  
‘mv’ n’est pas reconnu en tant que commande interne ou externe , un fichier excutable ou un fichier de commandes

in english  
invalid parameter -15  
invalid parameter -15  
‘mv’ is not recognized as an internal or external command, an executable file or a batch file  
maybe the problem that i’m on windows not linux -\_-

---

<div class="post-metadata">

**Author:** ![sheiser1](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/sheiser1/32/766_2.png) [@sheiser1](https://discourse.numenta.org/u/sheiser1)\
**Post date:** [August 27, 2018, 2:46pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/5 "2018-08-27T14:46:18Z")

</div>

Sure @way-sal no problem. If you’d like to show the code producing that error maybe I can help (I’m not sure where -15 should come in as a parameter). Though if its a windows vs linux issue I’ll have to defer

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 27, 2018, 2:50pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/6 "2018-08-27T14:50:03Z")

</div>

this the code of @learner : [https://github.com/psdyer/NuPIC-Algorithm-API-Example/blob/master/algorithm\_api\_example.ipynb](https://github.com/psdyer/NuPIC-Algorithm-API-Example/blob/master/algorithm_api_example.ipynb)

 ![cl](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/a/ae5ae2d7bed0ed238fc954d4ee503c66b851435d.png)

---

<div class="post-metadata">

**Author:** ![sheiser1](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/sheiser1/32/766_2.png) [@sheiser1](https://discourse.numenta.org/u/sheiser1)\
**Post date:** [August 27, 2018, 5:46pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/7 "2018-08-27T17:46:26Z")

</div>

I notice that he comments before the cell containing that code:

> For an extra treat, you can use the code below (on Linux) to make GIFs for the first N records of data.

You said you’re on Windows right, so maybe that part won’t work. The block on code seems to produce GIF’s, which is cool and likely work doing though not necessary to getting the algorithms running.

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 29, 2018, 8:04am UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/8 "2018-08-29T08:04:16Z")

</div>

oops yes, that’s part of code run on Linux and is not necessary so I delete

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 29, 2018, 10:49am UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/9 "2018-08-29T10:49:51Z")

</div>

the same error ::

 ![captur22](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/5/5ae807a9c59935f72251f988974b8d32e8cf3c53.png) ![Capture](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/6/6dc2ece5c9bae896a28f44b1b473ccebebc8425f.png)

---

<div class="post-metadata">

**Author:** ![Paul\_Lamb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/paul_lamb/32/2725_2.png) [@Paul\_Lamb](https://discourse.numenta.org/u/Paul_Lamb)\
**Post date:** [August 29, 2018, 11:11am UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/10 "2018-08-29T11:11:22Z")

</div>

That specific RuntimeError is saying that it is missing an environment variable called ‘USER’. You might try setting it to some value to see if you can get any further:

```auto
SET USER=dell

```

_(I don’t really use Windows much myself, so this may not be very helpful)_

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 29, 2018, 12:26pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/11 "2018-08-29T12:26:35Z")

</div>

no is not working ☹

---

<div class="post-metadata">

**Author:** ![Paul\_Lamb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/paul_lamb/32/2725_2.png) [@Paul\_Lamb](https://discourse.numenta.org/u/Paul_Lamb)\
**Post date:** [August 29, 2018, 12:59pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/12 "2018-08-29T12:59:27Z")

</div>

> [@way-sal](#):
>
> no is not working ☹

Do you get the same error about the environment variable ‘USER’ not being defined, or some different error?

If it is the same error, then someone more familiar with Windows will have to help. I saw a similar error about missing environment variable ‘USER’ when installing NuPIC from source in Docker, but in my case it was resolved after setting the environment variable.

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 27, 2018, 8:08am UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/13 "2018-08-27T08:08:31Z")

</div>

thanks @learner is very helpful , but what version of nupic do you use ? because i have a problem of modules , maybe my version of nupic can’t read some under moduls

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 29, 2018, 8:54am UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/14 "2018-08-29T08:54:18Z")

</div>

any idea ???

 ![Capture](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/6/6dc2ece5c9bae896a28f44b1b473ccebebc8425f.png)

---

<div class="post-metadata">

**Author:** ![learner](https://avatars.discourse-cdn.com/v4/letter/l/b782af/32.png) [@learner](https://discourse.numenta.org/u/learner)\
**Post date:** [August 29, 2018, 12:35pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/15 "2018-08-29T12:35:42Z")

</div>

Given the error, it looks like you need to define the USER environment variable. What is the code inside C:\Users\dell\Desktop\tests\moduls.py?

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 29, 2018, 12:57pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/16 "2018-08-29T12:57:22Z")

</div>

its your code :[https://github.com/psdyer/NuPIC-Algorithm-API-Example/blob/master/algorithm\_api\_example.ipynb](https://github.com/psdyer/NuPIC-Algorithm-API-Example/blob/master/algorithm_api_example.ipynb)  
and the other one is taken from :[http://nupic.docs.numenta.org/1.0.5/quick-start/algorithms.html](http://nupic.docs.numenta.org/1.0.5/quick-start/algorithms.html)  
pffff the same problemin configuration\_base.py

---

<div class="post-metadata">

**Author:** ![learner](https://avatars.discourse-cdn.com/v4/letter/l/b782af/32.png) [@learner](https://discourse.numenta.org/u/learner)\
**Post date:** [August 29, 2018, 12:59pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/17 "2018-08-29T12:59:23Z")

</div>

Try running these two lines of code from a fresh command line.

```auto
>> from nupic.algorithms.sdr_classifier_factory import SDRClassifierFactory
>> classifier = SDRClassifierFactory.create(steps=[1], alpha=0.01)

```

If you get an error there, then there’s something wrong with your setup.

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 29, 2018, 1:20pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/18 "2018-08-29T13:20:22Z")

</div>

yes the same problem

 ![bb](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/4/433255f468a7198ef8ef7688026925c5b29ca08d.png)

---

<div class="post-metadata">

**Author:** ![learner](https://avatars.discourse-cdn.com/v4/letter/l/b782af/32.png) [@learner](https://discourse.numenta.org/u/learner)\
**Post date:** [August 29, 2018, 1:26pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/19 "2018-08-29T13:26:36Z")

</div>

I’m at a loss then. I’ve only ever run NuPIC on Linux and Mac, and since this looks like a setup issue, I’m guessing something special has to be done in Windows. I suggest reading through the forum for [NuPIC+Windows topics](https://discourse.numenta.org/search?q=nupic%20windows) and see if there’s something you’re missing.

I don’t want to break your system, but as a hack you could try setting the USER variable to something/anything. I’m sure a quick google will show you how to do that.

---

<div class="post-metadata">

**Author:** ![way-sal](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/way-sal/32/3028_2.png) [@way-sal](https://discourse.numenta.org/u/way-sal)\
**Post date:** [August 29, 2018, 1:32pm UTC](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411/20 "2018-08-29T13:32:06Z")

</div>

ok thanks @learner , i will try that

[Next page](https://discourse.numenta.org/t/help-with-a-basic-python-error/4411.md?page=2)
