which makes answer refer to the function km_mi().
> Put the "return answer" line at the end, where the "answer=km_mi" used to
> be.
>
> That should help. The code calculates "answer". It prints "answer".
> You should return "answer&qu
er = km_mi"
> are certainly wrong, but it is not clear what you intend to do.
>
> On Mon, Aug 24, 2020 at 4:25 PM Py Noob wrote:
>
>> Hi!
>>
>> i'm new to python and would like some help with something i was working on
>> from a tutorial. I'm using VScode with 3.7.
Hi!
i'm new to python and would like some help with something i was working on
from a tutorial. I'm using VScode with 3.7.0 version on Windows 7. Below is
my code and the terminal is showing the word "None" everytime I execute my
code.
Many thanks!
print("Conversion")
def km_mi():
return
I am trying to learn techniques on image feature detection.
I have managed to detect horizontal line(unbroken/continuous), however I am
having trouble detecting all the dotted/broken lines in an image.
Here is my test image, as you can see there are dotted lines and some
text/boxes etc.
my
I'm using exec() to run a (multi-line) string of python code. If an
exception occurs, I get a traceback containing a stack frame for the
string. I've labeled the code object with a "file name" so I can
identify it easily, and when I debug, I find that I can interact with
the context of
Hello,
any ideas why this does not work?
def add(key, num):
... a[key] += num
...
a={}
a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22)
a
{'007-12': 22} # OK here, this is what I want
a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22)
a
{'007-12': None}
Sorry, wrong youtube url! The correct address is:
https://youtu.be/lwGkRv6YHrw
Cheers
Chris
2016-07-21 18:26 GMT+02:00 py notebook <textmodelv...@gmail.com>:
> PYNOTEBOOK
> ===
>
> Pynotebook is a command shell for interactive computing following the
> “no
PYNOTEBOOK
===
Pynotebook is a command shell for interactive computing following the
“notebook” concept which originally appeared with the program Mathematica
and became famous for python with the iPython/Jupyter project. Unlike
Jupyter, pynotebook runs inside an ordinary window and does
I am having some understandable behaviour from one of my function name
week_graph_data() which call two functions those return a big tuple of tuples,
But in function week_graph_data() line no. 30 does not work(returns no result
in graph or error).
I have check both functions are called in
Thanks a lot.
El martes, 12 de agosto de 2014 17:17:26 UTC-3, Mark Lawrence escribió:
On 12/08/2014 20:25, c1234 py wrote:
El martes, 12 de agosto de 2014 16:16:21 UTC-3, Christian Gollwitzer
escribi�:
Am 12.08.14 20:36, schrieb c1223:
Hi, Im working in the development
On Tuesday, August 12, 2014 3:36:17 PM UTC-3, c1234 py wrote:
Hi,
Im working in the development of a program based in python that allow us to
contrl a spectometer. The spectometer has an .dll file. The idea is to work
through this dll and operate the spectometer.
The name of the .dll
if it is, then I can see at
least one problem, a NameError.
ChrisA
This appear in the terminal:
runfile('C://Python Scripts')
File C:\\sitecustomize.py, line 585, in runfile
execfile(filename, namespace)
File C://Sin título 38.py, line 19, in module
hllApi = hllApiProto ((HLLAPI, hllDll
El martes, 12 de agosto de 2014 16:16:21 UTC-3, Christian Gollwitzer escribió:
Am 12.08.14 20:36, schrieb c1223:
Hi, Im working in the development of a program based in python that
allow us to contrl a spectometer. The spectometer has an .dll file.
The idea is to work through this
On Jan 18, 4:04 am, Peter Otten __pete...@web.de wrote:
What's the advantage of 'find ... | xargs ...' over 'find ... -exec ...'?
Portability. Running the '-exec' version will work fine in a directory
with a relatively small number of files, but will fail on a large one.
'xargs', which is
The explaination in my introductory Python book is not very
satisfying, and I am hoping someone can explain the following to me:
4 / 5.0
0.80004
4 / 5.0 is 0.8. No more, no less. So what's up with that 4 at the end.
It bothers me.
--
to create a file. The file had only one line of code and was
saved as module1.py. I saved it to Macintosh HD. The one line of code
in the file is copied below:
print 'Hello module world!'
I closed the file and tried to run it in IDLE and Terminal, but I have
had no success. I'll paste my
using Terminal or IDLE. I
used the IDLE editor to create a file with one line of code
print 'text string'
and I saved the file as module1.py. When using terminal I entered
python to load the interpreter or whatever and then tried
python module1.py
but I got an error message. I've
I am going to try posting here again with more detail to see if I can
finally get my first program to work.
I am working on a MacBook Pro with OS X 10.4.11. I opened a new window
in IDLE to create a file. The file had only one line of code and was
saved as module1.py. I saved it to Macintosh HD
or license for more information.
python module1.py
File stdin, line 1
python module1.py
^
SyntaxError: invalid syntax
Again, any help would be appreciated. Thanks.
From Terminal.app, this should work:
sean-marimpietris-computer:~ seanmarimpietri$ python module1.py
for you
(in IDLE then Terminal):
IDLE 2.6.2
python module1.py
SyntaxError: invalid syntax
The default IDLE window is a python shell window. That is, you are
already inside the python interpreter, the same as if you typed just
python, with no file name, in the Terminal window. You can use
X 10.4.11. I opened a new window
in IDLE to create a file. The file had only one line of code and was
saved as module1.py. I saved it to Macintosh HD. The one line of code
in the file is copied below:
print 'Hello module world!'
I closed the file and tried to run it in IDLE
I think this is maybe the most basic problem possible, but I can't get
even the most basic Python to run on OS X using Terminal or IDLE. I
used the IDLE editor to create a file with one line of code
print 'text string'
and I saved the file as module1.py. When using terminal I entered
python
I'm stuck trying to write a function that generates a factorial of a
number using iteration and not recursion. Any simple ideas would be
appreciated.
--
http://mail.python.org/mailman/listinfo/python-list
On 22 Oct, 13:28, Diez B. Roggisch [EMAIL PROTECTED] wrote:
Py-Fun wrote:
I'm stuck trying to write a function that generates a factorial of a
number using iteration and not recursion. Any simple ideas would be
appreciated.
Show us your attempts, and we might suggest a fix. Because
On 22 Oct, 13:43, Marco Mariani [EMAIL PROTECTED] wrote:
Py-Fun wrote:
def itforfact(n):
while n100:
print n
n+1
n = input(Please enter a number below 100)
You function should probably return something. After that, you can see
what happens with the result you get
understand so bether and unhapilly don´t had
sucess... I try normally the hands-on technique and to practise the DIY
philosophy; but in this case my mind isn´t helping me!:-)
Please, could you help me? :-) How to port this hi8 and lo8 to Python,
is there some function similar?
Tnx,
./Fernando -Py
sucess...
Big Hugs
Thanks
Regards.
-Py -Thorneiro
--
http://mail.python.org/mailman/listinfo/python-list
Excellent imput!
I learned
- no need for trailing . and i was doing it wrong anyway.
- all those extra trys were redundant.
- the trailing comma functionality in print.
- the extra ehlo is an rfc req.
Thanks all.
-dave
--
http://mail.python.org/mailman/listinfo/python-list
from smtplib import SMTP
from socket import sslerror #if desired
server = SMTP('smtp.gmail.com')
server.set_debuglevel(0) # or 1 for verbosity
server.ehlo('[EMAIL PROTECTED]')
server.starttls()
server.ehlo('[EMAIL PROTECTED]') # say hello again
server.login('[EMAIL PROTECTED]',
Hi, Jean Paul.
I read your code with interest. I wonder, does twisted also raise the socket
error or does it know
about this apparently well-known and often ignored incompatibility between the
standard and
the implementations?
Something else has occurred to me. After starting tls, all the
Hmm, my last post seems to have been redirected to /dev/null. Anyhoo.
Jean Paul, I read your code with interest. Does twisted also raise the
apparently well-known
and often ignored socket error, and do you supposed this error has something to
do with the
fact that the trailing \n.\n is
I would love for anybody to comment on this code with regard to
redundancy/efficiency/wordiness or whatever else.
for instance, do i understand correctly that i cant have a try: else: without
an intervening except:?
-dave
stdout.write(calling smtp server...)
try:
iwl ha escrito:
I would like to add Variables to my embedded python which represents
variables from my
C++-Programm.
I found C-Api-funcs for adding my C-Funcs to python but none to add
variables.
I would like some C-Function is called when the added Python-varible is
set (LValue) and
some
On 7 dic, 11:33, iwl [EMAIL PROTECTED] wrote:
What I found out up to now is to create a class inherited from an
fitting type
and overwrite the __setitem__ and __getitem__ method but haven't test
this
yet, something like that:
class test(int):
__setitem(self, value)__: C-Set-Func(value)
On 7 dic, 17:36, johnny [EMAIL PROTECTED] wrote:
I have python script does ftp download in a multi threaded way. Each
thread downloads a file, close the file, calls the comman line to
convert the .doc to pdf. Command line should go ahead and convert the
file. My question is, when each thread
On 7 dic, 18:52, tobiah [EMAIL PROTECTED] wrote:
Actually, do I have to make a WSDL? Do people hand write these, or
are there tools? I don't really need to publish an interface. I just
want some in house apps to communicate.
I can't figure out if I want SOAP, or CORBA, or would it just be
On 7 dic, 19:04, Will McGugan [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
I have a small application for which I would like to write an update
manager. I assume that the basics of it is to compare versions of the
user's current application and a new one store in a new file on a
On 18 nov, 19:06, Kai Kuehne [EMAIL PROTECTED] wrote:
It is possible to overwrite only one function with the property-function?
x = property(getx, setx, delx, 'doc')
I just want to overwrite setx, but when I set the others to None,
I can't read and del the member. Any ideas or is this not
Sorry to be a pest but is there anybody that could help me understand
a) if any of this is a problem; and b) where I can learn how to fix it.
Thank you very much for any pointers.
On 2006-07-10 11:45:51 -0400, Py PY [EMAIL PROTECTED] said:
(Apologies if this appears twice. I posted
Hi, list.I'm having a hard time trying to get a couple of tests to pass when compling Python 2.3.5 on Ubuntu Server Edition 6.06 LTS. I'm sure it's not too far removed from the desktop edition but, clearly, I need to tweak something or install some missling libs.uname -aLinux server
(Apologies if this appears twice. I posted it yesterday and it was held
due to a 'suspicious header')
I'm having a hard time trying to get a couple of tests to pass when
compling Python 2.3.5 on Ubuntu Server Edition 6.06 LTS. I'm sure it's
not too far removed from the desktop edition but,
I am trying to execute a batch script on a remote computer.
The batch script looks like:
@echo off
start c:\python24\python.exe c:\a_script.py
Here's the setup:
Computer A (my computer), Computer B (the remote computer).
So I map W: to Computer B and then copy the batch script to Computer
B.
WMI will work, i can create a new Win32_Process. XML_RCP would be
nice, but probably to much for what i need.
thanks.
--
http://mail.python.org/mailman/listinfo/python-list
I have two lists which I want to use to create a dictionary. List x
would be the keys, and list y is the values.
x = [1,2,3,4,5]
y = ['a','b','c','d','e']
Any suggestions? looking for an efficent simple way to do this...maybe
i am just having a brain fart...i feel like this is quit simple.
Thanks, itertools.izip and just zip work great. However, I should have
mentioned this, is that I need to keep the new dictionary sorted.
d = {1:'first', -5 : 'negative 5', 6:'six', 99:'ninety-nine',
3:'three'}
keys = d.keys()
keys.sort()
vals = map(d.get, keys)
At this point keys is sorted [-5,
Iain King wrote:
Short answer - you can't. Dictionaries aren't sequential structures,
so they have no sorted form. You can iterate through it in a sorted
manner however, as long as you keep your list of keys:
keys.sort()
for k in keys:
print d[k]
Iain
duh!thanks.
--
i need to read the contents of a file (could be 100kb, could be 500mb,
could be 1gb)...but I want to allow the read to be canceled.
for example, say a user wants to savea file...as it's saving they want
to terminate it...thus stop the read.
I was doing this:
def keepReading():
# return
i need to design a GUI for my python app. i heard of wxWidgets and was
going to look into that, but then I saw wxPython. Why would I use
wxPython over wxWidgets?
thanks
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence Oluyede wrote:
wxPython is the Python porting of wxWidgets.
got it, thanks.
--
http://mail.python.org/mailman/listinfo/python-list
I have the following code:
[code]
class MainFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, wx.ID_ANY, title,
style=wx.DEFAULT_FRAME_STYLE |wx.NO_FULL_REPAINT_ON_RESIZE)
# build top area
topSizer = self.buildTopPanel()
#
i have a website which runs apache on linux. it supports python (i
think via cginot sure how else). anyway how can I go to a web page
and run a python script or something like that? for example say i make
a script which prints out all the links on another URLhow can i run
that?
anyone know how to do perform the equivalent base64.urlsafe_b64encode
and base64.urlsafe_b64decode functions that Python has but in jython?
Jython comes with a base64 module but it does not have the urlsafe
functions. Tried copying the pythhon base64.py to replace the Jython
one, and although
Say I have...
x = 132.00
but I'd like to display it to be 132 ...dropping the trailing
zeros...I currently try this
if x.endswith(0):
x = x[:len(x)-1]
if x.endswith(0):
x = x[:len(x)-1]
if x.endswith(.):
x = x[:len(x)-1]
I do it like this because if
x = 132.15 ...i dont want to
hanz wrote:
x = x.rstrip('0.') # removes trailing zeroes and dots
knew there had to be a way, thanks.
--
http://mail.python.org/mailman/listinfo/python-list
I remember seeing somewhere saying that the wx.StaticBitmap is only for small image (64x64?), is that true?On 6 Jan 2006 07:01:24 -0800,
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
You can f.i. use wxPython (www.wxPython.org). Here is a compact andugly, but (almost) minimal, example of a python
Is there a way in python to figure out which process is running on
which port? I know in Windows XP you can run netstat -o and see the
process ID for each open portbut I am looking for something not
tied to windows particularly, hopefully something in python.
if not, any known way, such as
screwy.
I am going to try typing up that simple function into a new py file and
put it on a diff. PC and try it. I tried my current code on another
computer and had the same issue...but I am wondering if I start anew if
it will help.
--
http://mail.python.org/mailman/listinfo/python-list
py wrote:
I am going to try typing up that simple function into a new py file and
put it on a diff. PC and try it. I tried my current code on another
computer and had the same issue...but I am wondering if I start anew if
it will help.
ok, i am not sure whats going on. I created a simple
Hi,
I am running python 2.4.2 on win xp pro. I have the WMI module from
Tim Golden (http://tgolden.sc.sabren.com/python/wmi.html).
I have some code which does this...
MyScript.py
--
import wmi
# the ip of my own local desktop
machine = 1.2.3.4
try:
w = wmi.WMI(machine) #
here's the trace...
File MyScript.py, line 10,
wmiObj = wmi.WMI(machine)
File wmi.py, line 519, in __init__
handle_com_error (error_info)
File wmi.py, line 131, in handle_com_error
raise x_wmi, \n.join (exception_string)
x_wmi: -0x7ffbfe1c - Invalid syntax
--
one more note, I am using WMI v0.6 however, I also tried it with
the latest version 1.0 rc2.
--
http://mail.python.org/mailman/listinfo/python-list
Tim Golden wrote:
Could you just post (or send by private email if you prefer)
the exact script you're running? If you want to send it
privately, please us mail at timgolden.me.uk.
I am truly unsure what the problem could be, and the fact that the
error says invalid syntax ...just doesn't make
Tim Golden wrote:
code
import wmi
wmi._DEBUG = True
c = wmi.WMI ()
# This will print a moniker looking something like this:
#
winmgmts:{impersonationLevel=Impersonate,authenticationLevel=Default}/ro
ot/cimv2
/code
and let me know what comes out.
I ran it twice, first it worked, second
py wrote:
Something must be happening somewhere causing it
to get fouled up. I'm gonna try on a different PC.
I tried on another PC, same problem.
Also, I added reload(wmi) before I create an instance of wmi.WMI just
to see what happens, so I hve...
import wmi
def ppn(machine=None):
try
When you guys say 127~150 characters, did you guys mean usinging test_vectors.py in some way? Or there's no import at all?
--
http://mail.python.org/mailman/listinfo/python-list
On 12/27/05, Christian Tismer [EMAIL PROTECTED] wrote:
And we are of course implementing algorithms with a twisted goal-setin mind: How to express this the shortest way, not elegantly,just how to shave off one or even two bytes, re-iterating thepossible algorithms again and again, just to find a
I want to serialize an object in jython and then be able to read it in
using python, and vice versa.
Any suggestions on how to do this? pickle doesnt work, nor does using
ObjectOutputStream (from jython).
I prefer to do it file based ...something like
pickle.dump(someObj, open(output.txt, w))
Noah wrote:
You can give up on pickle, because pickle is only
guaranteed to work with the exact same version of the Python
interpreter.
:(
How complex of a serialization do you need?
simple
I just wrote the info out to a file. then i have a thread which reads
in the files and parses them
Alex Martelli wrote:
I suggest a redesign...!
What would you suggest? I have to encode/decode in chunks b/c of the
45 byte limitation.
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks...I think base64 will work just fine...and doesnt seem to have
45 byte limitations, etc.
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Say I have classes which represent parts of a car such as Engine, Body,
etc. Now I want to represent a Car in a nested dictionary like...
{string_id:{engine_id:engine_object, body_id:body_object}}ok?
Well the other thing is that I am allowed to store strings in this
dictionary...so I can't
Hi,
I am encoding a string such as...
[code]
data = someFile.readlines()
encoded = []
for line in data:
encoded.append(binascii.b2a_uu(stringToEncode))
return encoded
[/code]
...I then try to decode this by...
[code]
def decode(data):
result = []
for val in data:
Alex Martelli wrote:
binascii.b2a_uu only works for up to 45 bytes at once; but if you were
feeding it more than 45 bytes, this should raise a binascii.Error
itself.
Definitely not, given the above limit. But I still don't quite
understand the exact mechanics of the error you're getting.
the most recent version of PySNMP (like 4.1.x) has SNMP v3 support.
(not sure if its 100% or not...check with developer).
Anyhow I think the documentation explains how to use PySNMP
(http://pysnmp.sourceforge.net/docs/4.1.x/index.html) i think the
interface is common amongst the different
I have function which takes an argument. My code needs that argument
to be an iterable (something i can loop over)...so I dont care if its a
list, tuple, etc. So I need a way to make sure that the argument is an
iterable before using it. I know I could do...
def foo(inputVal):
if
I have function which takes an argument. My code needs that argument
to be an iterable (something i can loop over)...so I dont care if its a
list, tuple, etc. So I need a way to make sure that the argument is an
iterable before using it. I know I could do...
def foo(inputVal):
if
Dan Sommers wrote:
Just do it. If one of foo's callers passes in a non-iterable, foo will
raise an exception, and you'll catch it during testing
That's exactly what I don't want. I don't want an exception, instead I
want to check to see if it's an iterableif it is continue, if not
return
I am using subprocess.Popen to execute an executable, how can I
terminate that process when I want?
for example (on windows)
p = subprocess.Popen(calc.exe)
now say I want to kill calc.exe ...how can I do it? By the way, I am
not looking for a windows only solution I need something that is
Thanks for the replies. I agree with Jean-Paul Calderone's
suggestion...let the exception be raised.
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
I need to take a screen shot of the computer screen.
I am trying to use PIL and I saw there is ImageGrab...however it only
works on Windows. Is there a platform-independent ability to work
around this?
thanks
--
http://mail.python.org/mailman/listinfo/python-list
I have some data (in a string) such as
person number 1
Name: bob
Age: 50
person number 2
Name: jim
Age: 39
...all that is stored in a string. I need to pull out the names of the
different people and put them in a list or something. Any
suggestions...besides doing
Anyone here use SPE (http://www.stani.be/python/spe/blog/). ...the IDE?
Also, anyone know if it supports CVS or has a plugin for CVS? If not,
what do you use to get your code into CVS (via an IDE preferably)?
--
http://mail.python.org/mailman/listinfo/python-list
Looking for information on creating a GUI using a configuration file
(like an XML file or something). Also, how do you map actions (button
clicks, menu selections, etc) to the XML?
Any other suggestions for building GUI's for Python projects...even
Jython.
Thanks
--
how about wxPython? I am interested in something that will look native
on various operating systems (win, mac, *nix).
any good tutorial on using wxPython with XML?
--
http://mail.python.org/mailman/listinfo/python-list
wxPython sounds like it might be the ticket...especially with the XRC
files.
I plan on defining the GUI via XML, and actions in my python app.
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
anyone?
py wrote:
I have installed net-snmp and of course python on windows xp. I
downloaded yapsnmp (http://yapsnmp.sourceforge.net/) and I can't seem
to use it. It has a swig interface...but I get errors when trying to
swig it..
C:\yapsnmp-0.7.8\srcc:\Program Files\swigwin-1.3.25
I have installed net-snmp and of course python on windows xp. I
downloaded yapsnmp (http://yapsnmp.sourceforge.net/) and I can't seem
to use it. It has a swig interface...but I get errors when trying to
swig it..
C:\yapsnmp-0.7.8\srcc:\Program Files\swigwin-1.3.25\swig.exe -python
net-snmp.i
From what I have seen Python does not come with an snmp module built
in, can anyone suggest some other SNMP module (preferably one you have
used/experienced)..I have googled and seen yapsnmp and pysnmp (which
seem to be the two most active SNMP modules).
Thanks
--
...also I am looking to work with windows, as well as linux.
--
http://mail.python.org/mailman/listinfo/python-list
89 matches
Mail list logo