Menu

#383 pydev for other then *.py files

open
nobody
5
2009-09-21
2009-09-21
No

For instance for the SConstrcut file.

Eclipse (read pydev) doesn't recognize this as a Python file so when I open it I get no,... syntax highlighting, code analysis, TODO's in the task list,... etc.

I have one option and that is to open the (SConstruct, read none .py file) file by right clicking it, selecting 'Open With' and 'Other' then 'Python Editor'.

However, this way only pydev analysis and syntax highlighting seems to work not pylint and not 'Task Tags'

See also;
https://sourceforge.net/projects/pydev/forums/forum/293649/topic/3376744

Discussion

  • Brandon

    Brandon - 2009-09-25

    Associating files with PyDev is already possible. Go to Window -> Preferences then General -> Editors -> File Associations. Click Add... and type in the file type. Then in the bottom box associate the file type with PyDev. Then click on the 'Content Types' link (or go to General -> Content Types). Expand the text category and click on Python File. Click Add... and add in your file type again.

    BUT - This still does not solve that lint is not run and I dont think the code analysis is run either. I am working with Jython and the files we are working with must have a .jdl extension. I have the files associated but I don't get any error checking or anything. Please, how can we get this to work?

    Thanks

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-09-29

    Actually, the problem is only with files without extensions (such as SConstruct), for files with extensions, it should be enough adding it as you posted + adding it in window > preferences > pydev > editor > code style > file types.

    Cheers,

    Fabio

     
  • Brandon

    Brandon - 2009-09-29

    hmm..i added it to the list of extensions...but I still dont see any error highlighting. I tried typing a variable that does not exist and it doesnt show an error, also tried importing something that doesn't exist, no errors either. I went to the interpreters and just hit apply to reread the info, then I went to the project settings and did a 'force restore internal info' and also manually tried to build the project...still doesn't help

    I see a few exceptions in my .log file, not sure if it is related, i will attach it.

    Also, I noticed something weird, in the pydev package explorer it will show an arrow next to the file, showing that it can be expanded, when I click on it the arrow goes away....when I open the file it does show the correct outline in the outline window though

     
  • Brandon

    Brandon - 2009-09-29

    guess i cant attach anything...here are some of the exceptions...i know a couple arent related but might be good info for you to fix:

    !ENTRY org.eclipse.jface 4 0 2009-09-28 13:09:02.226
    !MESSAGE /icons/python_file.gif
    !STACK 0
    java.io.FileNotFoundException: /icons/python_file.gif
    at org.eclipse.osgi.framework.internal.protocol.bundleentry.Handler.findBundleEntry(Handler.java:44)
    at org.eclipse.osgi.framework.internal.core.BundleResourceHandler.openConnection(BundleResourceHandler.java:175)
    at java.net.URL.openConnection(URL.java:945)
    at org.eclipse.core.runtime.internal.adaptor.URLConverterImpl.toFileURL(URLConverterImpl.java:32)
    at org.eclipse.core.runtime.FileLocator.toFileURL(FileLocator.java:206)
    at org.eclipse.jface.resource.URLImageDescriptor.getFilePath(URLImageDescriptor.java:137)
    at org.eclipse.jface.resource.URLImageDescriptor.createImage(URLImageDescriptor.java:157)
    at org.eclipse.jface.resource.ImageDescriptor.createResource(ImageDescriptor.java:165)
    at org.eclipse.jface.resource.DeviceResourceManager.allocate(DeviceResourceManager.java:56)
    at org.eclipse.jface.resource.AbstractResourceManager.create(AbstractResourceManager.java:88)
    at org.eclipse.jface.resource.LocalResourceManager.allocate(LocalResourceManager.java:82)
    at org.eclipse.jface.resource.AbstractResourceManager.create(AbstractResourceManager.java:88)
    at org.eclipse.jface.resource.ResourceManager.createImageWithDefault(ResourceManager.java:192)
    at org.eclipse.jface.action.ActionContributionItem.updateImages(ActionContributionItem.java:1117)
    at org.eclipse.jface.action.ActionContributionItem.update(ActionContributionItem.java:942)
    at org.eclipse.jface.action.ActionContributionItem.fill(ActionContributionItem.java:291)
    at org.eclipse.ui.internal.console.ConsoleDropDownAction.addActionToMenu(ConsoleDropDownAction.java:111)
    at org.eclipse.ui.internal.console.ConsoleDropDownAction.getMenu(ConsoleDropDownAction.java:95)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:530)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1287)

    !ENTRY org.eclipse.jface 2 0 2009-09-28 13:09:02.227
    !MESSAGE The image could not be loaded: URLImageDescriptor(bundleentry://377.fwk1145892402/icons/python_file.gif)
    !STACK 0
    org.eclipse.jface.resource.DeviceResourceException: Unable to create resource URLImageDescriptor(bundleentry://377.fwk1145892402/icons/python_file.gif)
    at org.eclipse.jface.resource.ImageDescriptor.createResource(ImageDescriptor.java:167)
    at org.eclipse.jface.resource.DeviceResourceManager.allocate(DeviceResourceManager.java:56)
    at org.eclipse.jface.resource.AbstractResourceManager.create(AbstractResourceManager.java:88)
    at org.eclipse.jface.resource.LocalResourceManager.allocate(LocalResourceManager.java:82)
    at org.eclipse.jface.resource.AbstractResourceManager.create(AbstractResourceManager.java:88)
    at org.eclipse.jface.resource.ResourceManager.createImageWithDefault(ResourceManager.java:192)
    at org.eclipse.jface.action.ActionContributionItem.updateImages(ActionContributionItem.java:1117)
    at org.eclipse.jface.action.ActionContributionItem.update(ActionContributionItem.java:942)
    at org.eclipse.jface.action.ActionContributionItem.fill(ActionContributionItem.java:291)
    at org.eclipse.ui.internal.console.ConsoleDropDownAction.addActionToMenu(ConsoleDropDownAction.java:111)
    at org.eclipse.ui.internal.console.ConsoleDropDownAction.getMenu(ConsoleDropDownAction.java:95)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:530)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
    !SESSION 2009-09-28 15:30:21.878 -----------------------------------------------
    eclipse.buildId=I20090611-1540
    java.version=1.6.0_16
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
    Framework arguments: -product org.eclipse.epp.package.java.product
    Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product

    !ENTRY org.python.pydev 4 4 2009-09-29 11:12:05.432
    !MESSAGE org.eclipse.jface.text.BadLocationException
    !STACK 0
    java.lang.RuntimeException: org.eclipse.jface.text.BadLocationException
    at com.python.pydev.analysis.tabnanny.TabNannyDocIterator.internalBuildNext(TabNannyDocIterator.java:186)
    at com.python.pydev.analysis.tabnanny.TabNannyDocIterator.buildNext(TabNannyDocIterator.java:51)
    at com.python.pydev.analysis.tabnanny.TabNannyDocIterator.next(TabNannyDocIterator.java:46)
    at com.python.pydev.analysis.tabnanny.TabNanny.analyzeDoc(TabNanny.java:49)
    at com.python.pydev.analysis.OccurrencesAnalyzer.analyzeDocument(OccurrencesAnalyzer.java:65)
    at com.python.pydev.analysis.OccurrencesAnalyzer.analyzeDocument(OccurrencesAnalyzer.java:38)
    at com.python.pydev.analysis.builder.AnalysisBuilderRunnable.doAnalysis(AnalysisBuilderRunnable.java:223)
    at com.python.pydev.analysis.builder.AbstractAnalysisBuilderRunnable.run(AbstractAnalysisBuilderRunnable.java:125)
    at com.python.pydev.analysis.builder.AnalysisBuilderVisitor$3.run(AnalysisBuilderVisitor.java:180)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
    Caused by: org.eclipse.jface.text.BadLocationException
    at org.eclipse.jface.text.AbstractDocument.getChar(AbstractDocument.java:772)
    at org.eclipse.core.internal.filebuffers.SynchronizableDocument.getChar(SynchronizableDocument.java:153)
    at com.python.pydev.analysis.tabnanny.TabNannyDocIterator.internalBuildNext(TabNannyDocIterator.java:159)
    ... 9 more

     
  • Brandon

    Brandon - 2009-10-05

    hmmm....dunno what happened but I came in today and noticed I had errors highlighted in my jdl files now...I had a few weird crashes of eclipse at the end of last week and now its working fine....oh well, works now, thanks

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.