pyscripter and module locations.

89 views
Skip to first unread message

darkn...@gmail.com

unread,
Oct 25, 2016, 2:40:21 PM10/25/16
to PyScripter
Afternoon to All

I have been using pyscripter with python 3.4 but am having a problem importing a library module that I made for personal use. I tried adding the directory to path with TOOLS => PYTHON PATH command but when I restart pyscripter the string is once again missing from the path.  

From here I decided to look and see where a known working module (math) was located.  I started with all of the pyscripter directories even tho I suspected it would be in one of  the python 3.4  directories. But unfortunately I could not find it there either.  

SO .. what the heck gives.  What am I missing here. I need to figure this out because I have my own module that I need to put in the same directory.

All comments appreciated.

Poe

BBands

unread,
Oct 27, 2016, 6:40:29 PM10/27/16
to PyScripter Group
I thought about this quite a bit and can only think of one good solution, make it a Python package and install it. Not sure if that'll work for you, but it is what I do. There is a tutorial here: https://python-packaging.readthedocs.io/en/latest/

     John

Darknet Poe

unread,
Oct 28, 2016, 2:19:38 PM10/28/16
to pyscr...@googlegroups.com
John  thanks for the reply.  I did get to work correctly by putting it into C:\Python34\Lib\site-packages  and then I just created an alias in a working directory so that I could edit it and add more procedures to is it/when necessary. 

Strictly speaking I believe this is a python problem and NOT a Pyscripter prob .. however I do not know where to go to ask this type of question.   Suggestions from the community would be welcome.. oh by the way I looked on yahoo groups and google groups didnt find anything that looked particularly promising as many groups there are nearly defunct and have not seen any message traffic for weeks... 

Thanks for your help John

Poe

--
You received this message because you are subscribed to a topic in the Google Groups "PyScripter" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyscripter/nxWs45pNTv0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyscripter+unsubscribe@googlegroups.com.
To post to this group, send email to pyscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyscripter.
For more options, visit https://groups.google.com/d/optout.

BBands

unread,
Oct 28, 2016, 2:32:25 PM10/28/16
to PyScripter Group
The meme these days seems to be stackoverflow, but I am not all that sanguine about it. I just asked a perfectly reasonable question there and got voted down twice with no feedback or answer. It seems that posting a worked solution and asking for improvements is way worse that posting broken code and asking how to make it work. 

Darknet Poe

unread,
Oct 28, 2016, 2:43:45 PM10/28/16
to pyscr...@googlegroups.com
I have been trying to register on FREENODE but cant get the damn thing to send me an email back so I can click the link go figure. In any event Python is the most interesting language I have found in many years... its just that the community is not very helpful sometimes. 

I put together a module with a bunch of the common electrical/electronics formulae that I use and it seems to work except for one function that tells me you can call a float.  So I have been trying to go to the IRC channel to get help... oh well... I guess we will ge there.

thanks again


BBands

unread,
Oct 28, 2016, 3:04:39 PM10/28/16
to PyScripter Group
if you send me the snippet I will take a look for you.

As for IRC, the email should come back quickly.

Why not try this list?


     John

Darknet Poe

unread,
Oct 28, 2016, 4:21:46 PM10/28/16
to pyscr...@googlegroups.com
ok   here goes 
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#  The next functions calculate Resonant Frequency
#
#       Given:    Cpf, Luh
#       Returns:  Resonant Frequency in MHz
#
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

def _ResFreqMHz(Cpf, Luh):
    ''' calculates resonance Cpf given Luh for an RF circuit '''
    return ((10**3 / (2*math.pi(math.sqrt(Cpf * Luh)))))

def main():
    pass
Cpf = 500
Luh = 500

ResonantFreq =_ResFreqMHz (Cpf, Luh)
print (ResonantFreq)


if __name__ == '__main__':
    main()

and then I get back:
  File "C:\Python34\Lib\site-packages\Hamath.py", line 189, in _ResFreqMHz
    X = (10**3 / (2*math.pi(math.sqrt(Cpf * Luh))))
TypeError: 'float' object is not callable

ignore all the file path stuff.. its because this was called like the math library might be called and was external ..

funny but I have looked thoughout all of my docs... including on the Python home page and found nothing about error messages.. unless I missed it. Now that is possible because sometimes the brain doesnt work too swiftly these days. 

Poe

BBands

unread,
Oct 28, 2016, 5:11:51 PM10/28/16
to PyScripter Group
math.pi is not a function it is a constant so it is called as math.pi, not math.pi() If the answer is 0.318... then this is what you want.

"""
from math import pi, sqrt


def _ResFreqMHz(Cpf, Luh):
    ''' calculates resonance Cpf given Luh for an RF circuit '''
    return 10**3 / (2 * math.pi * math.sqrt(Cpf * Luh))

def main():

    Cpf = 500
    Luh = 500
    ResonantFreq =_ResFreqMHz (Cpf, Luh)
    print(ResonantFreq)

if __name__ == '__main__':
    main()

# That's all folks
"""

    John

BBands

unread,
Oct 28, 2016, 5:22:05 PM10/28/16
to PyScripter Group
The error message isn't all that obscure. It is telling you the a float object, in this case math.pi , is not callable as math.pi(). What it should have done is tell you WHAT float object wasn't callable. Sigh...

I made a few other stylistic changes, maybe they will help.

    John

--
You received this message because you are subscribed to the Google Groups "PyScripter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyscripter+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages