Announcement

Collapse
No announcement yet.

Python Help

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Python Help

    There is a programme that I want to try out, it is written in Python. Kubuntu already has Python installed and it is the latest version.
    So my question is how to get this programme to work uner Python?

    Thank you for any help, it is appreciated.

    #2
    What is the problem ?


    Code:
    $ python --help
    usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
    Options and arguments (and corresponding environment variables):
    -B     : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x
    -c cmd : program passed in as string (terminates option list)
    -d     : debug output from parser; also PYTHONDEBUG=x
    -E     : ignore PYTHON* environment variables (such as PYTHONPATH)
    -h     : print this help message and exit (also --help)
    -i     : inspect interactively after running script; forces a prompt even
             if stdin does not appear to be a terminal; also PYTHONINSPECT=x
    -m mod : run library module as a script (terminates option list)
    -O     : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x
    -OO    : remove doc-strings in addition to the -O optimizations
    -R     : use a pseudo-random salt to make hash() values of various types be
             unpredictable between separate invocations of the interpreter, as
             a defense against denial-of-service attacks
    -Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew
    -s     : don't add user site directory to sys.path; also PYTHONNOUSERSITE
    -S     : don't imply 'import site' on initialization
    -t     : issue warnings about inconsistent tab usage (-tt: issue errors)
    -u     : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x
             see man page for details on internal buffering relating to '-u'
    -v     : verbose (trace import statements); also PYTHONVERBOSE=x
             can be supplied multiple times to increase verbosity
    -V     : print the Python version number and exit (also --version)
    -W arg : warning control; arg is action:message:category:module:lineno
             also PYTHONWARNINGS=arg
    -x     : skip first line of source, allowing use of non-Unix forms of #!cmd
    -3     : warn about Python 3.x incompatibilities that 2to3 cannot trivially fix
    file   : program read from script file
    -      : program read from stdin (default; interactive mode if a tty)
    arg ...: arguments passed to program in sys.argv[1:]
    
    Other environment variables:
    PYTHONSTARTUP: file executed on interactive startup (no default)
    PYTHONPATH   : ':'-separated list of directories prefixed to the
                   default module search path.  The result is sys.path.
    PYTHONHOME   : alternate <prefix> directory (or <prefix>:<exec_prefix>).
                   The default module search path uses <prefix>/pythonX.X.
    PYTHONCASEOK : ignore case in 'import' statements (Windows).
    PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.
    PYTHONHASHSEED: if this variable is set to 'random', the effect is the same
       as specifying the -R option: a random value is used to seed the hashes of
       str, bytes and datetime objects.  It can also be set to an integer
       in the range [0,4294967295] to get hash values with a predictable seed.

    You could start the python script from the konsole:

    Code:
    python /path/to/the/script.py
    This should start the scrip execution or give an error message.


    Last edited by Rog132; Oct 28, 2013, 05:26 AM.
    A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
    Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

    Comment


      #3
      In addition to what Rog132 said, you can install IDLE for the version of Python you are using (2..7 and 3.2 are the defaults on Kubuntu) and it includes a debugger which runs in a virtual engine. IDLE is the default IDE for Python in Kubuntu. It shows the lines that have problems allowing you to jump to the line and make fixes. Syntactical problems it can fix, and logical problems like loop index errors, etc.

      A list of Python IDE's is here. It contains GPL and proprietary editors.

      My favorite Python GUI-RAD tool was boa-constructor, which is in the repository. It is a full fledged Visual Studio/QtCreator type RAD, including database controls, windows, frames, etc...., with a screen painter similar to Qt4-Designer.
      Boa-constructor is an IDE oriented towards creating cross-platform applications built on top of the Python language and the wxWindows GUI toolkit.

      It features:
      • visual wxWindows frame design,
      • object inspector and explorer,
      • syntax highlighting editor with code completion, call tips and code browsing for Python code,
      • syntax highlighting editor for C, C++, HTML, XML, config files (INI style),
      • documentation generation,
      • an integrated Python debugger,
      • integrated help,
      • a Python Shell,
      • an explorer able to browse, open/edit, inspect and interact with various data sources including files, CVS, Zope, FTP, DAV and SSH,
      • an UML view generator.
      When I last used it, it was a version 0.4. Now, I notice it is at 0.6. Development on the tool is slow, but it is a fairly complete GUI-RAD. Screen shots of what it looks like are here.

      Another, EXCELLENT, IDE is Eric, which is based on Qt4 and Python (both 2.7 and 3).
      It, too, is in the repository.
      What is Eric?

      Eric is a full featured Python and Ruby editor and IDE, written in python. It is based on the cross platform Qt gui toolkit, integrating the highly flexible Scintilla editor control. It is designed to be usable as everdays' quick and dirty editor as well as being usable as a professional project management tool integrating many advanced features Python offers the professional coder. eric4 includes a plugin system, which allows easy extension of the IDE functionality with plugins downloadable from the net.
      Current stable versions are eric4 based on Qt4 and Python 2 and eric5 based on Python 3 and Qt4.
      Screen shots are here.
      Last edited by GreyGeek; Oct 28, 2013, 05:55 AM.
      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment


        #4
        Just a shout out to Kdevelop and the python plugin. Best python IDE I have used by a massive margin. The auto completion and just general features is unparalleled by any other IDE. Kate with a plugin in gives many of the features of KDevelop including a lot of the auto-completion if you want something less intense.

        Comment


          #5
          Kate is an awesome tool. It was my primary Qt4 dev tool before QtCreator was released.
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            Originally posted by GreyGeek View Post
            Kate is an awesome tool. It was my primary Qt4 dev tool before QtCreator was released.
            Qt creator is good but I do not think it is as good a C++ and QT IDE as people make it out to be. It has a nice QML editor which unfortunately doesn't work on more complex projects. It does not allow tabs. It's very limited in when it comes to language support. Debugging is less than perfect. Code completion is alright but you just don't get the features that Kdevelop has. What it is brilliant at, is it's three click project set-up and great customizability. It's very easy to make your own SDK using it. Canonical is using Qt Creator as the basis of it's Ubuntu SDK.

            Comment


              #7
              Originally posted by dmeyer View Post
              Qt creator ..... does not allow tabs. It's very limited in when it comes to language support. Debugging is less than perfect.....
              Tabs? Do you mean within QtCreator itself, or projects created supported using it? Qt4-Designer allows tabs and QtCreator supports them. I can add, remove or modify tabs in windows and forms easily in QtCreator. Qt-Lingquist is where support for i18n comes from, and the language templates created can be added to the resources in a project and the appropriate dialog added to select the proper language during the first run, or based on an environmental variable.

              I believe that KDevelop is used by KDE developers, IIRC. It's a good tool now but when first looked at it 10 years ago it wasn't so good. That's why I stayed with Kate, which was a lot easier to use and ran a lot faster. I was using MS VS C++ 6.0 on XP but the main app I was building took 25 minutes to compile on a DELL G620. I dual booted into SuSE 6.4 and using Kate I was able to compile the same Qt4 source code in about 4 or 5 minutes. Debugging with KDbg was a LOT faster and easier as well. I usually restricted myself to two or three compiles per day with MSVS. In linux I could do the code-compile-debug cycle two or three times and hour, or more.
              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
              – John F. Kennedy, February 26, 1962.

              Comment


                #8
                Originally posted by GreyGeek View Post
                Tabs? Do you mean within QtCreator itself, or projects created supported using it? Qt4-Designer allows tabs and QtCreator supports them. I can add, remove or modify tabs in windows and forms easily in QtCreator. Qt-Lingquist is where support for i18n comes from, and the language templates created can be added to the resources in a project and the appropriate dialog added to select the proper language during the first run, or based on an environmental variable.
                By tabs I meant the interface of the IDE itself. I know you have the tabs on the side but that's more like a toolbar and not tabs like a browser or even Kate. By language I was also reffering to programming languages, not i18n which it does outstandingly in. It does have respectable syntax highlighting but it doesn't do in-line error highlighting for say python for example.

                Originally posted by GreyGeek View Post
                I believe that KDevelop is used by KDE developers, IIRC. It's a good tool now but when first looked at it 10 years ago it wasn't so good. That's why I stayed with Kate, which was a lot easier to use and ran a lot faster. I was using MS VS C++ 6.0 on XP but the main app I was building took 25 minutes to compile on a DELL G620. I dual booted into SuSE 6.4 and using Kate I was able to compile the same Qt4 source code in about 4 or 5 minutes. Debugging with KDbg was a LOT faster and easier as well. I usually restricted myself to two or three compiles per day with MSVS. In linux I could do the code-compile-debug cycle two or three times and hour, or more.
                It's funny. 10 years ago it was Kdevelop3 which at the time was unquestionably the best IDE on Linux. It supported every language under the sun and was so incredibly feature rich. Admittedly, Kdevelop4 has taken a while to mature but from 4.4 onwards I think it has been an exceptional IDE. Unfortunately, a lot of people have a dislike for it because it alienated many of its users from the Kdevelop3 days. Sort of how people hate KDE because of the early KDE4 days. Kdevelop4 integrates KatePart and then extends on it, so any plugin you can use on Kate works in Kdevelop. My big thing with Kdevelop is when I program in python or qml the smart auto-completion, easy code navigation, intelligent syntax highlighting, style parser, etc etc just make it such a competitive product.

                All my praise for it aside, I do have issues with it under Kubuntu. I don't know if the Kubuntu packaging is very different to Arch or openSUSE but I haven't as good an experience. Maybe this has been resolved in the last two releases?

                Comment


                  #9
                  It wasn't "unquestionable" for me. One of the apps I was responsible for where I worked was written using FoxPro for DOS. I rewrote it using VFP. But, MS announced that they were dropping VFP and pushing VFP developers to .NET. I was hanging out at the UniversalThread's VFP forum, along with 225,000 other VFP developers. That announcement caused an uproar. I could see the hand writing on the wall and began looking around for another GUI RAD tool. I tried some Java tools but the speed issue and the verbosity turned me off. I tried Python, using Boa-Constructor, and almost went with it. But, at the levels and subroutines where I need to place some of my code were warning: "DO NOT EDIT THIS FILE, IT WILL BE REGENERATED AUTOMATICALLY AT COMPILE TIME AND YOUR CHANGES WILL BE OVERWRITTEN." So close, yet so far. I really loved Python though, and used it for some other applications related to bulletin board service the dept of revenue was running for tax consultants. I gave Qt3 a try but really disliked it, and for me KDevelop really stunk, but that was probably Qt3's fault. If you used Qt3-Designer you had to call subroutines and subprograms by setting drop-down combo boxes in Qt3-Designer. What a straight jacket. I was on the verge of dropping it when Qt4 came out. Qt4 returned to the time-tested traditional C++ development style. The Designer was only for designing windows and forms. I've stuck with Qt4 every since. For me, Kate, KDbg and Qt4 made an awesome combo!
                  "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                  – John F. Kennedy, February 26, 1962.

                  Comment


                    #10
                    Thank you all for a lot of wonderful information, most of which sailed right over my bald head.

                    All I want to do is run a python programme.

                    Comment


                      #11
                      Originally posted by GreyGeek View Post
                      It wasn't "unquestionable" for me. One of the apps I was responsible for where I worked was written using FoxPro for DOS. I rewrote it using VFP. But, MS announced that they were dropping VFP and pushing VFP developers to .NET. I was hanging out at the UniversalThread's VFP forum, along with 225,000 other VFP developers. That announcement caused an uproar. I could see the hand writing on the wall and began looking around for another GUI RAD tool. I tried some Java tools but the speed issue and the verbosity turned me off. I tried Python, using Boa-Constructor, and almost went with it. But, at the levels and subroutines where I need to place some of my code were warning: "DO NOT EDIT THIS FILE, IT WILL BE REGENERATED AUTOMATICALLY AT COMPILE TIME AND YOUR CHANGES WILL BE OVERWRITTEN." So close, yet so far. I really loved Python though, and used it for some other applications related to bulletin board service the dept of revenue was running for tax consultants. I gave Qt3 a try but really disliked it, and for me KDevelop really stunk, but that was probably Qt3's fault. If you used Qt3-Designer you had to call subroutines and subprograms by setting drop-down combo boxes in Qt3-Designer. What a straight jacket. I was on the verge of dropping it when Qt4 came out. Qt4 returned to the time-tested traditional C++ development style. The Designer was only for designing windows and forms. I've stuck with Qt4 every since. For me, Kate, KDbg and Qt4 made an awesome combo!
                      Wow. I never really knew Linux before 2007 so I don't have experiences you have. I only used Linux frequently from 2010 and it became my main system in 2011.

                      Comment

                      Working...
                      X