Python Forum
Poll: Bring back the original codebox?
You do not have permission to vote in this poll.
Bring back the original codebox and let users choose whether they want default codebox (simpler) or use the syntax highlighted codebox
20.00%
1 20.00%
Keep only the syntax highlighted code box
60.00%
3 60.00%
Keep only the default original codebox
20.00%
1 20.00%
Total 5 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More codebox issues
#15
(Oct-13-2016, 01:15 AM)wavic Wrote: How about this? It should work. More information.

Actually, CTRL+SHIFT+V should be browser specific.

The first does not work. At least not as expected
I added that then the code is
<pre class="brush: python">valid</pre><br><pre class="brush: python">=</pre><br><pre class="brush: python">"1234567890"</pre><br><pre class="brush: python">some stuff (flushing rangefinder, read RF data, etc)</pre><br><pre class="brush: python">data2</pre><br><pre class="brush: python">=</pre><br><pre class="brush: python">self</pre><br><pre class="brush: python">.RF.readline()          </pre><br><pre class="brush: python"># read the rangefinder</pre><br><pre class="brush: python">Rnge2 </pre><br><pre class="brush: python">=</pre><br><br><pre class="brush: python">str</pre><br><pre class="brush: python">(data2)[</pre><br><pre class="brush: python">str</pre><br><pre class="brush: python">(data2).index(</pre><br><pre class="brush: python">'R'</pre><br><pre class="brush: python">)</pre><br><pre class="brush: python">+</pre><br><pre class="brush: python">1</pre><br><pre class="brush: python">:</pre><br><pre class="brush: python">str</pre><br><pre class="brush: python">(data2).index(</pre><br><pre class="brush: python">'R'</pre><br><pre class="brush: python">)</pre><br><pre class="brush: python">+</pre><br><pre class="brush: python">5</pre><br><pre class="brush: python">] </pre><br><pre class="brush: python">#strips down to 4 numbers</pre><br><pre class="brush: python">Rnge2 </pre><br><pre class="brush: python">=</pre><br><br><pre class="brush: python">Rnge2.replace(</pre><br><pre class="brush: python">"'"</pre><br><pre class="brush: python">,"")  </pre><br><pre class="brush: python">#removes any single quotes</pre><br><pre class="brush: python">while</pre><br><br><pre class="brush: python">True</pre><br><pre class="brush: python">:</pre><br><pre class="brush: python">    </pre><br><pre class="brush: python">if</pre><br><br><pre class="brush: python">not</pre><br><br><pre class="brush: python">set</pre><br><pre class="brush: python">(Rnge2).issubset(valid):      </pre><br><pre class="brush: python">#check for invalid chars - S/B only numerics</pre><br><pre class="brush: python">            </pre><br><pre class="brush: python">Rnge </pre><br><pre class="brush: python">=</pre><br><br><pre class="brush: python">'9000'</pre><br><pre class="brush: python">            </pre><br><pre class="brush: python">break</pre><br><pre class="brush: python">    </pre><br><pre class="brush: python">if</pre><br><br><pre class="brush: python">Rnge2 </pre><br><pre class="brush: python">=</pre><br><pre class="brush: python">=</pre><br><br><pre class="brush: python">'</pre><br><pre class="brush: python">' :             #issubset won'</pre><br><pre class="brush: python">t catch this</pre><br><pre class="brush: python">            </pre><br><pre class="brush: python">Rnge </pre><br><pre class="brush: python">=</pre><br><br><pre class="brush: python">'9000'</pre><br><pre class="brush: python">            </pre><br><pre class="brush: python">break</pre><br><pre class="brush: python">    </pre><br><pre class="brush: python">if</pre><br><br><pre class="brush: python">int</pre><br><pre class="brush: python">(Rnge2) > </pre><br><pre class="brush: python">1000</pre><br><br><pre class="brush: python">:          </pre><br><pre class="brush: python">#I get the error here</pre><br><pre class="brush: python">            </pre><br><pre class="brush: python">Rnge </pre><br><pre class="brush: python">=</pre><br><br><pre class="brush: python">'9000'</pre>
when it should be this
valid="1234567890"
some stuff (flushing rangefinder, read RF data, etc)
data2=self.RF.readline()          # read the rangefinder
Rnge2 = str(data2)[str(data2).index('R')+1:str(data2).index('R')+5] #strips down to 4 numbers
Rnge2 = Rnge2.replace("'","")  #removes any single quotes
while True:
    if not set(Rnge2).issubset(valid):      #check for invalid chars - S/B only numerics
            Rnge = '9000'
            break
    if Rnge2 == '' :             #issubset won't catch this
            Rnge = '9000'
            break
    if int(Rnge2) > 1000 :          #I get the error here
            Rnge = '9000'
Recommended Tutorials:
Reply


Messages In This Thread
More codebox issues - by Mekire - Oct-12-2016, 04:05 AM
RE: More codebox issues - by metulburr - Oct-12-2016, 04:32 AM
RE: More codebox issues - by Mekire - Oct-12-2016, 04:36 AM
RE: More codebox issues - by metulburr - Oct-12-2016, 04:38 AM
RE: More codebox issues - by metulburr - Oct-12-2016, 04:39 AM
RE: More codebox issues - by wavic - Oct-12-2016, 08:20 AM
RE: More codebox issues - by metulburr - Oct-12-2016, 11:31 AM
RE: More codebox issues - by wavic - Oct-12-2016, 01:00 PM
RE: More codebox issues - by snippsat - Oct-12-2016, 09:10 PM
RE: More codebox issues - by metulburr - Oct-13-2016, 12:09 AM
RE: More codebox issues - by metulburr - Oct-13-2016, 12:10 AM
RE: More codebox issues - by wavic - Oct-13-2016, 12:26 AM
RE: More codebox issues - by metulburr - Oct-13-2016, 12:38 AM
RE: More codebox issues - by wavic - Oct-13-2016, 01:15 AM
RE: More codebox issues - by metulburr - Oct-13-2016, 03:39 AM
RE: More codebox issues - by Skaperen - Oct-13-2016, 04:16 AM
RE: More codebox issues - by wavic - Oct-13-2016, 08:15 AM
RE: More codebox issues - by snippsat - Oct-13-2016, 01:09 PM
RE: More codebox issues - by Kebap - Oct-13-2016, 01:38 PM
RE: More codebox issues - by metulburr - Oct-13-2016, 02:00 PM
RE: More codebox issues - by snippsat - Oct-13-2016, 02:13 PM
RE: More codebox issues - by metulburr - Oct-13-2016, 03:31 PM
RE: More codebox issues - by sparkz_alot - Oct-13-2016, 04:04 PM
RE: More codebox issues - by metulburr - Oct-13-2016, 04:19 PM
RE: More codebox issues - by Kebap - Oct-13-2016, 04:31 PM
RE: More codebox issues - by metulburr - Oct-13-2016, 04:35 PM
RE: More codebox issues - by wavic - Oct-13-2016, 05:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  codebox usage help doc metulburr 0 1,713 Oct-31-2020, 12:12 PM
Last Post: metulburr
  single/double quote escapes codebox highlighter metulburr 3 3,600 Aug-08-2017, 01:36 PM
Last Post: metulburr
  codebox borders metulburr 15 16,084 Nov-24-2016, 04:04 AM
Last Post: snippsat
  URL not showing properly in comments of codebox Larz60+ 4 5,643 Nov-05-2016, 04:23 PM
Last Post: Larz60+
  Syntax Highlighter Codebox Issues metulburr 38 28,868 Oct-06-2016, 01:06 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020