|
Go To
![]() |
Post
![]() |
Search BB
![]() |
Notify Me
![]() |
TOS/Tools/Smilies
![]() |
Reply
![]() |
|
|
Coming along... |
Hi. Python looks like something useful that I should be learning. Does anyone know of a package I can install in my Python for Windows to make it easier to use for copying files and other command-line tasks? I'd like Python to behave as if its got a current directory, copy/delete/search/rename my files, modify attributes, and run programs like a shell does. Then I can just leave it up on my screen like a terminal program.
If I import the group of functions called 'OS' then I can send a command through Python to DOS, but that's not really what I want. What I'd like is to know if somebody has already made a wrapper around that, providing a virtual shell (commandline) environment inside the python box. I'm too inexperienced to write one, and if I did it would be buggy. Note to self: This is post #52, so you became an Emerging at #50 and are no longer a Freshie -- except to certain people. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
||
|
Enthusiast...![]() |
I don't know of such a package. But having recently been studying a little Python myself, I'd encourage you to continue working with it. Parts of it hurt my brain
-- Stephen |
|||
|
|
Forum Host |
To use mouse selecting and right-click
pasting, go to the System Menu on your console and select Properties > Options > Quick Edit Mode. You can then use the mouse to select an area and can be right-click pasted straight in. For the other functions you mentioned, try iPython: http://ipython.scipy.org/moin/Download or IDLE: http://www.ai.uga.edu/mc/idle/index.html Jeff/CompGuy |
|||
|
|
Coming along... |
Stephen, I will play with it perhaps; but I need it to be useful on my desktop. Its an interpreter, and it can make system calls. It calculates, and maybe someday I will even get it to do symbolic algebra. I like it lots. Now I just want it to do a 'Dir' or 'Ls', a 'CD', a 'Cp', and 'Rmdir' etc. in real time. I'll let you know if I find what I'm looking for. If not it could be my first Python project. Maybe.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
|
Coming along... |
Thanks comp-guy, I'll take a look at that project!
I've found Python has an 'OS' module and a 'SHUTIL' module that can do a directory listing/copy/move files and some other file operations. I just import the modules, and then I can manipulate files. I do not know if I can start a system utility from Python, but I do not see why not. Maybe I won't ever need to learn any shell scripting ever again. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
|
Coming along... |
Well Comp Guy,
The IPython is looking interesting, although currently I cannot use it since I must use Python 2.6. Currently the IPython is only tested to work with 2.4, and I need the 2.6 in order to try out various Python programs. So far, 2.6 seems like the compatibility mule. The creation of 3.0 has frozen the Python 2 series, because it introduces extensive changes in the way that strings are handled. The clear indications are that the Python 2 series is not going to change much in the future. It could be that Python development will fork into a conservative (2x series) and a liberal (3+) camp. Its one of those situations where somebody wants to change the drapes but somebody else doesn't. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
|
Forum Host |
Are you sure? According to the link I gave you above, there's both an egg and an RPM version of IPython available for Python 2.6--it's the stable version, too, not a beta version. Again, see: http://ipython.scipy.org/moin/Download Jeff/CompGuy |
|||
|
|
Coming along... |
Here's how to get i-Python installed. (I haven't played with it yet, but its installed). These are not step-by-step instructions but they are more than the minimum:
1. -- Install the most current version of Python 2.6.x and only use the version compiled for 32-bit architectures. The reason is that for I-python, some further prequisites are not available in a way that is compatible with Windows 64-bit. They are close to getting them working, but its a slow process. Just install everything for 32-bit architecture. 2. -- After you've installed Python, next install the most current NumPy packed for 32-bit Windows. It adds modules which extend Python's set of Math functions, and Ipython will need these. 3. -- Next, install PyReadline. This makes up for the difference between the Unix consoles and your Windows CMD prompt. Ipython needs this package as a prerequisite. 4. -- Install WxPython, which is a set of functions that extend Python's ability to make windows with little buttons, etc. It takes it from being mostly a text system to something that can do more graphics by incorporating the WX Widgets, which are a cool way of allowing programmers to write a windowed program once and have it work on multiple kinds of computers. 5. -- Install Setup_Tools. Currently the Python developers are developing this tool to simplify and automate the process of installing Python stuff. You will need it in order to install IPython. 6. Ok, now go to the Start pearl or button, go to accessories, right-click on command or terminal and choose 'Run as administrator'. Give it your password. Now use your MS-Dos CD command to get to C:\Python26\Scripts. Type "easy_install ipython" press enter. Sit back and watch it install. You're done! Wasn't that easy? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
|
Coming along... |
Ok, that was tricky, but getting this IPython was totally worth it. Thanks, compguy. It really is a nice programmable shell interface for my windows Vista. So now I feel more in control of the commandline, and if I want to process files or automate things I can do it.
When describing installation procedure, I forgot to mention that you should probably also install a package called 'Nose' at step 6, and Ipython should be installed after that. So, just put installing Nose in before the final step. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
Enthusiast...![]() |
You might also find the new Windows PowerShell worth a look. I haven't done anything with it really besides install it on several machines, and read a little a while ago, but it should enable you to get at the guts of Windows to automate things which would otherwise be difficult to do. It comes with Win7 and iirc WS2K8, but it's also available for Vista and XP and WS2K3 through Windows Update.
Another free automation option is AutoIt. It won't let you reach directly down into Windows' innards like PowerShell should, but you can automate Windows GUI windows to accomplish the same end result. For automating interactive command line applications, you might consider the "Expect" module of the "Tcl" scripting language. With it, you can write scripts to send commands to cmdline apps and receive their output and act accordingly, as though the script were taking your place at the keyboard. -- Stephen |
|||
|
|
Coming along... |
Stephen, good ideas.
Powershell looks like a wondertool for Windows admins. I actually did download an early version of Powershell and I have a few of the early recorded workshop videos about it from Microsoft, but I never really got far. Looks good and I may want it someday. I'm just playing around with portable scripting though -- nothing requiring deep system tools. TCL and Autoit look like they are nice, too. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
|
Coming along... |
Now that I've got ipython running, its encouraged me to get an internet site. I got myself a domain and a mod_python hosting server; and I'm thinking about how to write scripts and serve pages. I'm reading mod_python tutorials, etc. This might be a long term project.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
Enthusiast...![]() |
Google supports Python (and Java) for their free hosting. I don't know whether they're running specifically mod_python on Apache servers though. The big thing that stood out as different to me was that they don't offer SQL databases. Instead they use a different kind of datastore which is supposed to be more scalable for apps with massive numbers of users.
-- Stephen |
|||
|
|
Coming along... |
Well, I have not been doing anything on my Python site or anything; and I went from a mod_python server to a plain old under construction sign. Wrist slap me, but I've put it aside for other things.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
|
Coming along... |
Not that it matters but I have installed the apache web server. Next step I guess is to start learning some html, then perhaps configure the server to do some tricks in preparation to go live. Is there a reason why you would pick PHP, Java, Python, or any other web script? HTML5? Open to all comments.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
|
Devoted... |
Somebody who's learned more than some basics of html might pick one of those others, but I haven't. Oh well.
Henry |
|||
|
|
Forum Host |
Depends on what you're trying to do, what you know, and how much time/work/money you're prepared to spend. There's no answer that's right for everyone.
Jeff/CompGuy |
|||
|
Enthusiast...![]() |
My impression, being in a similar position (although my test web server is configured in a VirtualBox virtual machine, to keep from cluttering up my real machine), is that for just starting to try things out PHP is the first choice. It's pretty simple, has been around for a long, long while (in Internet time), has tons of freely available modules and apps, is most widely supported by third party web hosts should you decide to go public at some point, etc.
Python, while a decent choice, would probably be a somewhat distant second for web apps, currently. Java, from what I've seen, is probably more used for enterprise-level applications (in its J2EE form) than for general web apps. As previously mentioned, Google's "App Engine" hosting supports both Python and Java, but not PHP. Perl also boasts of some major web apps among its users. Whatever language you chose for the server, you could still include some Javascript on the client. You could even include Java applets, though they are rather rare nowadays. (I remember when they were touted as the(?) way of The Future(TM).) For the choice of HTML version though, I'd go with HTML5; it probably really is the future, though v.4 will hang around for a long time to come yet, if only because recoding everything to v.5 would be an insane amount of work for no particular benefit (assuming the updated apps didn't add any new v.5 features) and lots of risk of breaking existing apps. -- Stephen |
|||
|
|
Forum Host |
If you're really doing "enterprise-level" stuff, you shouldn't be hosting your own Web site at all. Use a commercial hosting firm. When you're in business, you need 24/7 monitoring of your server and site. And unless you're running a really small business, you need far more speed and bandwidth than you can get on a typical home or office DSL/cable/satellite connection.
Jeff/CompGuy |
|||
|
Enthusiast...![]() |
|
|||
|
|
Coming along... |
Thanks guys. Somehow I didn't see these last few responses until recently. Still have all of my Python stuff installed and been playing with it. I learned some html, as little as possible, and got an extremely simple site up.
Probably for Enterprise content I would definitely go with web hosting like you're saying. I got an account with webfaction for about a month, which is a hosting service that supports a lot of different apps. I tried it for a month and will probably go back to it after I actually have a site to put up. I like the google idea too. Probably I will not go with PHP, just because I'm too lazy to add yet another scripting flavor right now. I'll stick with what I've already been playing with. I've been looking at D-Jango content management program, and that is interesting. It runs on top of mod_python to streamline web content management, and its open source. One you read all the manuals and figure out the system, its fairly flexible about what you can put onto it and simple to keep up. Configuring it does have a slight learning curve for me, because I'm still just playing with the Python. Interesting thing I learned about Python is 'List comprehensions'. List Comprehensions are small one-line programs that produce complex lists of items. They take only one line, very short, which is very nice. They can also be nested. In the below example you could take 'range(1,6)' and replace it with another List Comprehension. An example: [str(round(355/113.0, i)) for i in range(1,6)] Returns the following list of numbers stored as character strings: ['3.1', '3.14', '3.142', '3.1416', '3.14159'] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|
Enthusiast...![]() |
I recently heard about the "Tiki Wiki CMS Groupware" project and installed it on my server to try it out. It's pretty neat. It's an all-in-one package for making flexible web sites, including features for blogs, articles, galleries, wikis, forums, rss feeds, shopping cart, etc. It could be a quick and easy way to set up a main site, with links to other specialized pieces you code up yourself.
http://info.tiki.org/Tiki+Wiki+CMS+Groupware -- Stephen |
|||
|
|
Coming along... |
Thanks for the heads up on that. May be I should try it out next.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sun now rose upon the right: Out of the sea came he, Still hid in mist, and on the left Went down into the sea. |
|||
|