Search Results

Search found 14486 results on 580 pages for 'python idle'.

Page 254/580 | < Previous Page | 250 251 252 253 254 255 256 257 258 259 260 261  | Next Page >

  • Pythonic reading from config files

    - by Adam Matan
    Hi, I have a python class which reads a config file using ConfigParser: Config file: [geography] Xmin=6.6 Xmax=18.6 Ymin=36.6 YMax=47.1 Python code: class Slicer: def __init__(self, config_file_name): config = ConfigParser.ConfigParser() config.read(config_file_name) # Rad the lines from the file self.x_min = config.getfloat('geography', 'xmin') self.x_max = config.getfloat('geography', 'xmax') self.y_min = config.getfloat('geography', 'ymin') self.y_max = config.getfloat('geography', 'ymax') I feel that the last four lines are repetitive, and should somehow be compressed to one Pythonic line that would create a self.item variable for each item in the section. Any ideas? Adam

    Read the article

  • String searching algorithm for Chinese characters.

    - by Jack Low
    There are Python code available for existing algorithms for normal string searching e.g. Boyer-Moore Algorithm. I am looking to use this on Chinese characters and it doesn't seem like the same implementation would work. What would I go about doing in order to make the algorithm work on Chinese characters? I am referring to this: http://en.literateprograms.org/Boyer-Moore_string_search_algorithm_(Python)#References

    Read the article

  • What's the pythonic way of declaring variables?

    - by the_drow
    Usually declaring variables on assignment is considered a best practice in VBScript or JavaScript , for example, although it is allowed. Why does Python force you to create the variable only when you use it? Since Python is case sensitive can't it cause bugs because you misspelled a variable's name? How would you avoid such a situation?

    Read the article

  • Several numpy arrays with SWIG

    - by Petter
    I am using SWIG to pass numpy arrays from Python to C++ code: %include "numpy.i" %init %{ import_array(); %} %apply (float* INPLACE_ARRAY1, int DIM1) {(float* data, int n)}; class Class { public: void test(float* data, int n) { //... } }; and in Python: c = Class() a = zeros(5) c.test(a) This works, but how can I pass multiple numpy arrays to the same function?

    Read the article

  • Openerp WIth ubuntu 9.04

    - by agbrand
    I had Ubuntu 8.10. I upgrade it to 9.04. I have Openerp5.0 , server/client/web. It worked on 8.10 but not with 9.04. Now when I try to launch my server using: ./openerp-server.py I have this error: ERROR: Import xpath module ERROR: Try to install the old python-xml package It seems that this version of openerp doesn't work with python2.6. Can you help me to redirect openerp to use old version of python please?

    Read the article

  • Best web application language for Delphi Developers

    - by DelphiDev
    I'm Delphi developer, and I would like to build few web applications, I know about Intraweb, but I think it's not a real tool for web development, maybe for just intranet applications so I'm considering PHP, Python or ruby, I prefer python because it's better syntax than other( I feel it closer to Delphi), also I want to deploy the application to shared hosting, specially Linux. so as Delphi developer, what do you choose to develop web application?

    Read the article

  • Best resources for starting Jython

    - by Eric Wendelin
    I just got my first Jython (and Python) project, and I was wondering what documentation, IDEs, etc. are best suited to a Java buff like me. I know there are a lot of questions about starting out with Python, so I'm asking for things that might be specific to Jython. Where should I start? If it helps, I'm running Linux and Solaris only.

    Read the article

  • error: Unable to find vcvarsall.bat

    - by okada
    Hello. I'm trying to install dulwich for bzr-git. now, I use Python 2.6 based bazaar. (I use msys.) My steps are as follows: $ bzr branch lp:dulwich $ cd dulwich/ $ python setup.py install running install running build running build_py creating build : : creating build\lib.win32-2.6\dulwich\tests : : running build_ext building 'dulwich._objects' extension error: Unable to find vcvarsall.bat If you know any hints, tell me please. Thanks. Okada.

    Read the article

  • Using SimpleXMLTreeBuilder in elementtree

    - by Shard
    I have been developing an application with django and elementtree and while deploying it to the production server i have found out it is running python 2.4. I have been able to bundle elementtree but now i am getting the error: "No module named expat; use SimpleXMLTreeBuilder instead" Unfortunately i cannot upgrade python so im stuck with what i got. How do i use SimpleXMLTreeBuilder as the parser and/or will i need to rewrite code?

    Read the article

  • Help with filetype association!

    - by Zachary Brown
    I have the actual assoication part down, but when I open the file that is associated with my Python program, how do I get the filepath of the file opened? I think it is something like sys.argv? But that just returns the path to the python program, not the associated file.

    Read the article

  • os.environ() giving errors while setting for Hudson

    - by Arnab Sen Gupta
    I want a small python script to set the HUDSON_HOME environment variable. When using the shell, I can easily do this using set HUDSON_HOME=http://localhost:8080 But how can I do the same directly through python?? I don't want to do it by passing the command line to os.system().. can os.environ() be of any help?? I had in my script: import os os.environ('HUDSON_HOME')='http://localhost:8080' but it's probably setting it for the subprocss and not the parent shell..any way around this??

    Read the article

  • Unicode troubles

    - by user343803
    Hello, i have just known Python for few days. Unicode seems to be a problem with Python. i have a text file stores a text string like this '\u0110\xe8n \u0111\u1ecf n\xfat giao th\xf4ng Ng\xe3 t\u01b0 L\xe1ng H\u1ea1' i can read the file and print the string out but it displays incorrectly. How can i print it out to screen correctly as follow: "Ðèn d? nút giao thông Ngã tu Láng H?" Thanks in advance

    Read the article

  • untar from run command in fibre

    - by Shah.Bhavesh
    i want to untar file from source to destination with below statement `def untar(source,destination): run("tar -xf {0} {1}".format(source,destination)) ` i am getting Error C:\Users\test\Desktop\fabric>fab -H user@host-p pass untar:source =/shared/sample.tar,destination=/home/ Traceback (most recent call last): File "C:\Users\shasmukh\AppData\Roaming\Python\Python27\site-packages\fabric\m ain.py", line 630, in main docstring, callables, default = load_fabfile(fabfile) File "C:\Users\shasmukh\AppData\Roaming\Python\Python27\site-packages\fabric\m ain.py", line 163, in load_fabfile imported = importer(os.path.splitext(fabfile)[0]) File "C:\Users\shasmukh\Desktop\fabric\fabfile.py", line 11 def copy(source,destination) ^ SyntaxError: invalid syntax

    Read the article

  • Temporary PYTHONPATH in Windows

    - by Santa
    How do I set, temporarily, the PYTHONPATH environment variable just before executing a Python script? In *nix, I can do this: $ PYTHONPATH='.' python scripts/doit.py In Windows, this syntax does not work, of course. What is the equivalent, though?

    Read the article

  • How can I tell [G]vim where to look for python26.dll?

    - by Ariel
    I have a version of Vim compiled with python 2.6 support enabled (from here). however vim cannot find the python26.dll. :version confirms +python/dyn :version and gvim.exe confirms DYNAMIC_PYTHON_DLL="python26.dll" echo PATH confirms python26.dll is in the search path. (both c:\windows\system32, and C:\python26) What could I be missing? Did I skip something silly?

    Read the article

  • Which programming language to choose? (for a specific problem/domain, details inside)

    - by Bijan
    I am building a trading portfolio management system that is responsible for production, optimization, and simulation of non-high frequency trading portfolios (dealing with 1min or 3min bars of data, not tick data). I plan on employing Amazon web services to take on the entire load of the application. I have four choices that I am considering as language. a) Java b) C++ c) C# d) Python Here is the scope of the extremes of the project scope. This isn't how it will be, maybe ever, but it's within the scope of the requirements: Weekly simulation of 10,000,000 trading systems. (Each trading system is expected to have its own data mining methods, including feature selection algorithms which are extremely computationally-expensive. Imagine 500-5000 features using wrappers. These are not run often by any means, but it's still a consideration) Real-time production of portfolio w/ 100,000 trading strategies Taking in 1 min or 3 min data from every stock/futures market around the globe (approx 100,000) Portfolio optimization of portfolios with up to 100,000 strategies. (rather intensive algorithm) Speed is a concern, but I believe that Java can handle the load. I just want to make sure that Java CAN handle the above requirements comfortably. I don't want to do the project in C++, but I will if it's required. The reason C# is on there is because I thought it was a good alternative to Java, even though I don't like Windows at all and would prefer Java if all things are the same. Python - I've read somethings on PyPy and pyscho that claim python can be optimized with JIT compiling to run at near C-like speeds.... That's pretty much the only reason it is on this list, besides that fact that Python is a great language and would probably be the most enjoyable language to code in, which is not a factor at all for this project, but a perk. To sum up: - real time production - weekly simulations of a large number of systems - weekly/monthly optimizations of portfolios - large numbers of connections to collect data from There is no dealing with millisecond or even second based trades. The only consideration is if Java can possibly deal with this kind of load when spread out of a necessary amount of EC2 servers. Thank you guys so much for your wisdom.

    Read the article

  • List multiplication

    - by Schitti
    Hi, Python newbie here. I have a list L = [a, b, c] and I want to generate a list of tuples : [(a,a), (a,b), (a,c), (b,a), (b,b), (b,c)...] I tried doing L * L but it didn't work. Can someone tell me how to get this in python.

    Read the article

  • where to use a pyc file?

    - by sia
    i want to know what is a pyc file(python bytecode) i want to know all details, i want to know about the compiler, is it a replacement for exe? does it need to be run by python? is it as portable as .py file is? where sould i use this? tnx

    Read the article

  • wx.NotificationMessage AttributeError: 'module' object has no attribute 'NotificationMessage'

    - by HughGrigg
    I get this error when trying to use wxPython's NotificationMessage class: wx.NotificationMessage("", "Hello world!").Show() AttributeError: 'module' object has no attribute 'NotificationMessage' The code is quite simply: #!/usr/bin/python import wx app = wx.App() wx.NotificationMessage("", "Hello world!").Show() app.MainLoop() What am I missing? This is running on Linux Mint 13, MATE 1.2 desktop environment, Python 2.7.3.

    Read the article

  • Git pre-commit hook: getting list of changed files

    - by Mikko Ohtamaa
    I am developing validation and linting utility to be integrated with various commit hooks, including Git one https://github.com/miohtama/vvv Currently validators and linters are run against the whole project codebase on every commit. However, it would be much more optimal to run them against changed files only. For this, I would need to know changed files list in my Git precommit hook (in Python) https://github.com/miohtama/vvv/blob/master/vvv/hooks/git.py What options I have to extract the changed files list (in Python if that matters)?

    Read the article

< Previous Page | 250 251 252 253 254 255 256 257 258 259 260 261  | Next Page >